aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
...
* Version bump.Eric S. Raymond1999-08-282-3/+3
* Date stamp.Eric S. Raymond1999-08-211-3/+1
* Version bump.Eric S. Raymond1999-08-211-1/+1
* Handle broken pipes.Eric S. Raymond1999-08-212-76/+104
* Don Willis's I/O code.Eric S. Raymond1999-08-212-21/+36
* Don't bounce mail on transient errors.Eric S. Raymond1999-08-212-7/+8
* Add autorobe clause for HP OpenMail.Eric S. Raymond1999-08-211-0/+9
* Add license notice.Eric S. Raymond1999-08-211-3/+7
* Changes from the road.Eric S. Raymond1999-08-176-22/+38
* Corrections.Eric S. Raymond1999-08-031-3/+2
* RPA support works.Eric S. Raymond1999-08-034-49/+37
* Uopate user count.Eric S. Raymond1999-08-021-1/+1
* Ready to ship.Eric S. Raymond1999-08-022-2/+2
* Kevin Turner's bugfix.Eric S. Raymond1999-08-022-7/+14
* Heimdal GSSAPI patches.Eric S. Raymond1999-08-025-10/+83
* Flag changes from Horst von Brand.Eric S. Raymond1999-08-021-1/+2
* *** empty log message ***Eric S. Raymond1999-08-011-1/+2
* Use LOCKBUSY better.Eric S. Raymond1999-08-012-5/+18
* Split in rightmost @Eric S. Raymond1999-08-012-2/+13
* Better MONITOR_SLOP fix.Eric S. Raymond1999-08-011-5/+25
* Upload the man page.Eric S. Raymond1999-08-011-0/+1
* *** empty log message ***Eric S. Raymond1999-08-011-1/+4
* Added web-ized manual page.Eric S. Raymond1999-08-011-2/+10
* Added a man page link.Eric S. Raymond1999-08-011-0/+2
* Note that RPA is broken.Eric S. Raymond1999-08-012-4/+11
* New iten on TCP/IP stalling problem.Eric S. Raymond1999-08-011-4/+30
* Fix broken parsing.Eric S. Raymond1999-08-011-23/+20
* Postfix-aware.Eric S. Raymond1999-07-313-4/+8
* The big lexer fix.Eric S. Raymond1999-07-313-22/+34
* Before applying Brian Boutel's lexer fix.Eric S. Raymond1999-07-316-13/+51
* Changed maintainers list.Eric S. Raymond1999-07-311-7/+12
* Show usernames surrounded by quotes.Eric S. Raymond1999-07-311-12/+12
* *** empty log message ***Eric S. Raymond1999-06-261-3/+3
* Ready to ship.Eric S. Raymond1999-06-262-4/+4
* Simplify the expunge logic.Eric S. Raymond1999-06-261-2/+2
* Also expunge on re-poll when expunge period is zero.Eric S. Raymond1999-06-261-2/+4
* Fix Chris Evert's bug.Eric S. Raymond1999-06-262-9/+10
* Support imapd PREAUTH response.Eric S. Raymond1999-06-263-3/+19
* *** empty log message ***Eric S. Raymond1999-06-251-3/+10
* Root screwup.Eric S. Raymond1999-06-251-3/+12
* The function from64tobits() in fetchmail-5.0.4 recognizesEric S. Raymond1999-06-181-1/+1
* Fix lockfile screwage.Eric S. Raymond1999-06-162-5/+11
* Add a HAVE_SNPRINTF.Eric S. Raymond1999-06-151-0/+4
* Attempt to fix a mimedecode bug.Eric S. Raymond1999-06-152-8/+10
* *** empty log message ***Eric S. Raymond1999-06-141-1/+1
* Added German and Spanish descriptions to specfile (thanks to Horst vonEric S. Raymond1999-06-142-12/+18
* Feature update.Eric S. Raymond1999-06-131-5/+2
* OpenBSD port patches.Eric S. Raymond1999-06-126-5/+29
* Initial revisionEric S. Raymond1999-06-121-0/+11
* Show the glibc version.Eric S. Raymond1999-06-121-1/+4
f"><stdio.h> #include <ctype.h> #if defined(STDC_HEADERS) #include <stdlib.h> #endif #if defined(HAVE_UNISTD_H) #include <unistd.h> #endif #include <string.h> #include <pwd.h> #include <errno.h> #include "fetchmail.h" /* Python prettyprinting functions */ static int indent_level; static void indent(char ic) /* indent current line */ { int i; if (ic == ')' || ic == ']' || ic == '}') indent_level--; /* * The guard here is a kluge. It depends on the fact that in the * particular structure we're dumping, opening [s are always * initializers for dictionary members and thus will be preceded * by a member name. */ if (ic != '[') { for (i = 0; i < indent_level / 2; i++) putc('\t', stdout); if (indent_level % 2) fputs(" ", stdout); } if (ic) { putc(ic, stdout); putc('\n', stdout); } if (ic == '(' || ic == '[' || ic == '{') indent_level++; } static void stringdump(const char *name, const char *member) /* dump a string member with current indent */ { indent('\0'); fprintf(stdout, "\"%s\":", name); if (member) fprintf(stdout, "\"%s\"", visbuf(member)); else fputs("None", stdout); fputs(",\n", stdout); } static void numdump(const char *name, const int num) /* dump a numeric quantity at current indent */ { indent('\0'); fprintf(stdout, "'%s':%d,\n", name, num); } static void booldump(const char *name, const int onoff) /* dump a boolean quantity at current indent */ { indent('\0'); if (onoff) fprintf(stdout, "'%s':TRUE,\n", name); else fprintf(stdout, "'%s':FALSE,\n", name); } static void listdump(const char *name, struct idlist *list) /* dump a string list member with current indent */ { indent('\0'); fprintf(stdout, "\"%s\":", name); if (!list) fputs("None,\n", stdout); else { struct idlist *idp; fputs("[", stdout); for (idp = list; idp; idp = idp->next) if (idp->id) { fprintf(stdout, "\"%s\"", visbuf(idp->id)); if (idp->next) fputs(", ", stdout); } fputs("],\n", stdout); } } /* * Note: this function dumps the entire configuration, * after merging of the defaults record (if any). It * is intended to produce output parseable by a configuration * front end, not anything especially comfortable for humans. */ void dump_config(struct runctl *runp, struct query *querylist) /* dump the in-core configuration in recompilable form */ { struct query *ctl; struct idlist *idp; indent_level = 0; fputs("from Tkinter import TRUE, FALSE\n\n", stdout); /* * We need this in order to know whether `interface' and `monitor' * are valid options or not. */ #ifdef linux fputs("os_type = 'linux'\n", stdout); #else fputs("os_type = 'generic'\n", stdout); #endif /* * This should be approximately in sync with the -V option dumping * in fetchmail.c. */ printf("feature_options = ("); #ifdef POP2_ENABLE printf("'pop2',"); #endif /* POP2_ENABLE */ #ifdef POP3_ENABLE printf("'pop3',"); #endif /* POP3_ENABLE */ #ifdef IMAP_ENABLE printf("'imap',"); #endif /* IMAP_ENABLE */ #ifdef GSSAPI printf("'imap-gss',"); #endif /* GSSAPI */ #if defined(IMAP4) && defined(KERBEROS_V4) printf("'imap-k4',"); #endif /* defined(IMAP4) && defined(KERBEROS_V4) */ #ifdef RPA_ENABLE printf("'rpa',"); #endif /* RPA_ENABLE */ #ifdef SDPS_ENABLE printf("'sdps',"); #endif /* SDPS_ENABLE */ #ifdef ETRN_ENABLE printf("'etrn',"); #endif /* ETRN_ENABLE */ #if OPIE printf("'opie',"); #endif /* OPIE */ #if INET6 printf("'inet6',"); #endif /* INET6 */ #if NET_SECURITY printf("'netsec',"); #endif /* NET_SECURITY */ printf(")\n"); fputs("# Start of configuration initializer\n", stdout); fputs("fetchmailrc = ", stdout); indent('{'); numdump("poll_interval", runp->poll_interval); booldump("syslog", runp->use_syslog); stringdump("logfile", runp->logfile); stringdump("idfile", runp->idfile); stringdump("postmaster", runp->postmaster); booldump("invisible", runp->invisible); if (!querylist) { fputs(" 'servers': []\n", stdout); goto alldone; } indent(0); fputs("# List of server entries begins here\n", stdout); indent(0); fputs("'servers': ", stdout); indent('['); for (ctl = querylist; ctl; ctl = ctl->next) { /* * First, the server stuff. */ if (!ctl->server.lead_server) { flag using_kpop; /* * Every time we see a leading server entry after the first one, * it implicitly ends the both (a) the list of user structures * associated with the previous entry, and (b) that previous entry. */ if (ctl > querylist) { indent(']'); indent('}'); indent('\0'); putc(',', stdout); putc('\n', stdout); } indent(0); fprintf(stdout,"# Entry for site `%s' begins:\n",ctl->server.pollname); indent('{'); using_kpop = (ctl->server.protocol == P_POP3 && ctl->server.port == KPOP_PORT && ctl->server.preauthenticate == A_KERBEROS_V4); stringdump("pollname", ctl->server.pollname); booldump("active", !ctl->server.skip); stringdump("via", ctl->server.via); stringdump("protocol", using_kpop ? "KPOP" : showproto(ctl->server.protocol)); numdump("port", ctl->server.port); numdump("timeout", ctl->server.timeout); numdump("interval", ctl->server.interval); if (ctl->server.envelope == STRING_DISABLED) stringdump("envelope", NULL); else if (ctl->server.envelope == NULL) stringdump("envelope", "Received"); else stringdump("envelope", ctl->server.envelope); numdump("envskip", ctl->server.envskip); stringdump("qvirtual", ctl->server.qvirtual); if (ctl->server.preauthenticate == A_KERBEROS_V4) stringdump("auth", "kerberos_v4"); else if (ctl->server.preauthenticate == A_KERBEROS_V5) stringdump("auth", "kerberos_v5"); else stringdump("auth", "password"); #if defined(HAVE_GETHOSTBYNAME) && defined(HAVE_RES_SEARCH) booldump("dns", ctl->server.dns); #endif /* HAVE_GETHOSTBYNAME && HAVE_RES_SEARCH */ booldump("uidl", ctl->server.uidl); listdump("aka", ctl->server.akalist); listdump("localdomains", ctl->server.localdomains); #ifdef linux stringdump("interface", ctl->server.interface); stringdump("monitor", ctl->server.monitor); #endif /* linux */ stringdump("plugin", ctl->server.plugin); stringdump("plugout", ctl->server.plugout); indent(0); fputs("'users': ", stdout); indent('['); } indent('{'); stringdump("remote", ctl->remotename); stringdump("password", ctl->password); indent('\0'); fprintf(stdout, "'localnames':["); for (idp = ctl->localnames; idp; idp = idp->next) { char namebuf[USERNAMELEN + 1]; strncpy(namebuf, visbuf(idp->id), USERNAMELEN); namebuf[USERNAMELEN] = '\0'; if (idp->val.id2) fprintf(stdout, "(\"%s\", %s)", namebuf, visbuf(idp->val.id2)); else fprintf(stdout, "\"%s\"", namebuf); if (idp->next) fputs(", ", stdout); } if (ctl->wildcard) fputs(", '*'", stdout); fputs("],\n", stdout); booldump("fetchall", ctl->fetchall); booldump("keep", ctl->keep); booldump("flush", ctl->flush); booldump("rewrite", ctl->rewrite); booldump("stripcr", ctl->stripcr); booldump("forcecr", ctl->forcecr); booldump("pass8bits", ctl->pass8bits); booldump("dropstatus", ctl->dropstatus); booldump("mimedecode", ctl->mimedecode); stringdump("mda", ctl->mda); stringdump("bsmtp", ctl->bsmtp); indent('\0'); if (ctl->listener == LMTP_MODE) fputs("'lmtp':TRUE,", stdout); else fputs("'lmtp':FALSE,", stdout); #ifdef INET6 stringdump("netsec", ctl->netsec); #endif /* INET6 */ stringdump("preconnect", ctl->preconnect); stringdump("postconnect", ctl->postconnect); numdump("limit", ctl->limit); numdump("warnings", ctl->warnings); numdump("fetchlimit", ctl->fetchlimit); numdump("batchlimit", ctl->batchlimit); numdump("expunge", ctl->expunge); stringdump("properties", ctl->properties); listdump("smtphunt", ctl->smtphunt); stringdump("smtpaddress", ctl->smtpaddress); indent('\0'); fprintf(stdout, "'antispam':'"); if (!ctl->antispam) fputs("'\n", stdout); else { for (idp = ctl->antispam; idp; idp = idp->next) { fprintf(stdout, "%d", idp->val.status.num); if (idp->next) fputs(" ", stdout); } fputs("',\n", stdout); } listdump("mailboxes", ctl->mailboxes); indent('}'); indent('\0'); fputc(',', stdout); } /* end last span of user entries and last server entry */ indent(']'); indent('}'); /* end array of servers */ indent(']'); alldone: /* end top-level dictionary */ indent('}'); fputs("# End of initializer\n", stdout); } /* conf.c ends here */