X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=netrc.c;h=5af542735349214d901c9f0f0f0ad5f366ede832;hb=87dc71c7c26e8532b19b55f58e2786f9af53f2e3;hp=6c68d2c0b1381f7ec24ecc8ad1a955614370df69;hpb=025dc8b68e812f4cdb0943baf8d43d3683651490;p=~andy%2Ffetchmail diff --git a/netrc.c b/netrc.c index 6c68d2c0..5af54273 100644 --- a/netrc.c +++ b/netrc.c @@ -10,15 +10,18 @@ (Makefile.am should have a rule so you can just type "make netrc") */ +#define _XOPEN_SOURCE 600 + +#include "config.h" + #include #include #include #include -#include "config.h" #include "fetchmail.h" #include "netrc.h" -#include "i18n.h" +#include "gettext.h" #ifdef STANDALONE /* Normally defined in xstrdup.c. */ @@ -28,7 +31,7 @@ # define xmalloc malloc # define xrealloc realloc -char *program_name = "netrc"; +const char *program_name = "netrc"; #endif /* Maybe add NEWENTRY to the account information list, LIST. NEWENTRY is @@ -76,8 +79,7 @@ maybe_add_to_list (netrc_entry **newentry, netrc_entry **list) list of entries. NULL is returned if the file could not be parsed. */ netrc_entry * -parse_netrc (file) - char *file; +parse_netrc (char *file) { FILE *fp; char buf[POPBUFSIZE+1], *p, *tok; @@ -291,9 +293,7 @@ parse_netrc (file) /* Return the netrc entry from LIST corresponding to HOST. NULL is returned if no such entry exists. */ netrc_entry * -search_netrc (list, host, login) - netrc_entry *list; - char *host, *login; +search_netrc (netrc_entry *list, char *host, char *login) { /* Look for the HOST in LIST. */ while (list) @@ -314,8 +314,10 @@ void free_netrc(netrc_entry *a) { while(a) { netrc_entry *n = a->next; - memset(a->password, 0x55, strlen(a->password)); - xfree(a->password); + if (a->password != NULL) { + memset(a->password, 0x55, strlen(a->password)); + free(a->password); + } xfree(a->login); xfree(a->host); xfree(a); @@ -332,7 +334,7 @@ free_netrc(netrc_entry *a) { int main (int argc, char **argv) { struct stat sb; - char *program_name, *file, *host, *login; + char *file, *host, *login; netrc_entry *head, *a; program_name = argv[0];