source: trunk/debathena/third/alpine/alpine-1.00-hesiod.patch @ 23068

Revision 23068, 4.0 KB checked in by ghudson, 16 years ago (diff)
Add a debathenify script for alpine. Currently only works for hardy and lenny.
  • imap/src/c-client/mail.c

    diff -ur alpine-1.00/imap/src/c-client/mail.c alpine-1.00+hesiod/imap/src/c-client/mail.c
    old new  
    3131#include <stdio.h> 
    3232#include <time.h> 
    3333#include "c-client.h" 
     34#ifdef HESIOD 
     35#include <hesiod.h> 
     36#endif 
    3437 
    3538char *UW_copyright = "Copyright 1988-2007 University of Washington\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n"; 
    3639 
     
    715718} 
    716719 
    717720 
     721#ifdef HESIOD 
     722/* Mail lookup and validate hesiod information 
     723 * Accepts: NETMBX structure to process 
     724 * Returns: T on success, NIL on failure 
     725 */ 
     726 
     727static long mail_valid_hesiod (NETMBX *mb) 
     728{ 
     729  char *user; 
     730  struct hesiod_postoffice *office; 
     731  struct servent *serv; 
     732  char tmp[MAILTMPLEN], service[NETMAXSRV]; 
     733  void *hcontext; 
     734 
     735  if (mb->user && *mb->user)    /* Allows for the /user=foo switch */ 
     736    user = mb->user; 
     737  else 
     738    user = myusername (); 
     739  sprintf (tmp,"Hesiod lookup for \"%s\"",user); 
     740  mm_log (tmp,NIL); 
     741 
     742  if (hesiod_init (&hcontext) == 0) { 
     743    office = hesiod_getmailhost (hcontext,user); 
     744    if (office && *office->hesiod_po_type 
     745        && *office->hesiod_po_host && *office->hesiod_po_name) { 
     746      sprintf(tmp,"Hesiod answer: %s %s %s", 
     747              office->hesiod_po_type,office->hesiod_po_host, 
     748              office->hesiod_po_name); 
     749      mm_log(tmp,NIL); 
     750    } 
     751    else { 
     752      sprintf (tmp,"Hesiod error while determining PO server for \"%s\"",user); 
     753      mm_log (tmp,ERROR); 
     754      if (office) 
     755        hesiod_free_postoffice (hcontext,office); 
     756      hesiod_end (hcontext); 
     757      return NIL; 
     758    } 
     759  } 
     760  else { 
     761      sprintf(tmp, 
     762              "Hesiod initialization error determining PO server for \"%s\"", 
     763              user); 
     764      mm_log(tmp,ERROR); 
     765      return NIL; 
     766  } 
     767 
     768  strcpy(mb->host,office->hesiod_po_host); 
     769  strcpy(mb->user,office->hesiod_po_name); 
     770  /* Set service if it isn't specified, but don't force compliance. */ 
     771  if (!*mb->service) { 
     772    if (!strcmp (office->hesiod_po_type,"POP")) 
     773      strcpy (mb->service,"pop3"); 
     774    else if (!strcmp (office->hesiod_po_type,"IMAP")) 
     775      strcpy (mb->service,"imap"); 
     776    else { 
     777      sprintf (tmp,"Hesiod error while determining PO server for \"%s\"",user); 
     778      mm_log (tmp,ERROR); 
     779      return NIL; 
     780    } 
     781  } 
     782 
     783  hesiod_free_postoffice (hcontext,office); 
     784  hesiod_end (hcontext); 
     785 
     786  return T; 
     787} 
     788#endif /* HESIOD */ 
     789 
     790 
    718791/* Mail validate network mailbox name 
    719792 * Accepts: mailbox name 
    720793 *          NETMBX structure to return values 
     
    802875      else {                    /* non-argument switch */ 
    803876        if (!compare_cstring (s,"anonymous")) mb->anoflag = T; 
    804877        else if (!compare_cstring (s,"debug")) mb->dbgflag = T; 
     878#ifdef HESIOD 
     879        else if (!compare_cstring (s,"hesiod")) mb->hesflag = T; 
     880#endif 
    805881        else if (!compare_cstring (s,"readonly")) mb->readonlyflag = T; 
    806882        else if (!compare_cstring (s,"secure")) mb->secflag = T; 
    807883        else if (!compare_cstring (s,"norsh")) mb->norsh = T; 
     
    842918      return NIL; 
    843919    } while (c);                /* see if anything more to parse */ 
    844920  } 
     921#ifdef HESIOD 
     922  if (mb->hesflag) { 
     923    if (!mail_valid_hesiod (mb)) 
     924      return NIL; 
     925  } 
     926#endif 
    845927                                /* default mailbox name */ 
    846928  if (!*mb->mailbox) strcpy (mb->mailbox,"INBOX"); 
    847929                                /* default service name */ 
  • imap/src/c-client/mail.h

    diff -ur alpine-1.00/imap/src/c-client/mail.h alpine-1.00+hesiod/imap/src/c-client/mail.h
    old new  
    662662  unsigned int norsh : 1;       /* don't use rsh/ssh */ 
    663663  unsigned int loser : 1;       /* server is a loser */ 
    664664  unsigned int tlssslv23 : 1;   /* force SSLv23 client method over TLS */ 
     665#ifdef HESIOD 
     666  unsigned int hesflag : 1;     /* Hesiod flag */ 
     667#endif 
    665668} NETMBX; 
    666669 
    667670/* Item in an address list */ 
Note: See TracBrowser for help on using the repository browser.