head 1.13; access; symbols new_system:1.8 old_system:1.8; locks alexis:1.13; strict; comment @ * @; 1.13 date 99.04.26.16.17.29; author alexis; state Exp; branches; next 1.12; 1.12 date 99.01.07.13.11.53; author alexis; state Exp; branches; next 1.11; 1.11 date 98.10.17.12.56.23; author alexis; state Exp; branches; next 1.10; 1.10 date 98.10.07.16.26.26; author alexis; state Exp; branches; next 1.9; 1.9 date 98.08.28.13.12.12; author alexis; state Exp; branches; next 1.8; 1.8 date 98.08.07.11.28.42; author alexis; state Exp; branches; next 1.7; 1.7 date 97.11.11.11.57.25; author alexis; state Exp; branches; next 1.6; 1.6 date 97.10.26.12.12.29; author alexis; state Exp; branches; next 1.5; 1.5 date 97.10.20.16.59.18; author alexis; state Exp; branches; next 1.4; 1.4 date 97.02.25.17.52.25; author alexis; state Exp; branches; next 1.3; 1.3 date 97.02.21.17.05.13; author alexis; state Exp; branches; next 1.2; 1.2 date 97.02.09.16.00.50; author alexis; state Exp; branches; next 1.1; 1.1 date 97.02.01.21.52.17; author alexis; state Exp; branches; next ; desc @MILEPOST - WORKS @ 1.13 log @enlarged string buffers removed 'newshost' support removed quality/idle check interval relationship testing @ text @#include /* for FILE* and NULL */ #include /* for strstr(), strerror[] */ #include "utils.h" /* for debug funcs */ #include /* for errno */ #include /* for getpwnam() */ #include /* for getgrnam() */ #include /* for getpwnam() support */ #include /* for umask() */ #include "ppplcd_cfg.h" #include "ppplcd.h" /* for extern ipc_owner .. */ char chatfile[PPPLCD_CFG_MAXSTRLEN]; char qtest_cmd[PPPLCD_CFG_MAXSTRLEN]; char usecnt_cmd[PPPLCD_CFG_MAXSTRLEN]; char news_cmd[PPPLCD_CFG_MAXSTRLEN]; char misc_cmd[PPPLCD_CFG_MAXSTRLEN]; char mail_cmd[PPPLCD_CFG_MAXSTRLEN]; int pppd_debug = 0; int pppd_kdebug = 0; /*@@unused@@*/ static char *ppplcd_cfg_c_rcs_id = "$Header: /diskb/home/alexis/dev/supported/ppplc/bin/RCS/ppplcd_cfg.c,v 1.12 1999/01/07 13:11:53 alexis Exp alexis $"; struct strchnrec { char *str; struct strchnrec *nxt; }; struct strchnrec *strchnroot = NULL; static void init_config() { struct strchnrec *linkaddr, *tmp; debug(DBG_FUNCS, "init_config: sof"); sprintf(chatfile, "%s/%s.%d.chat", TMP_DIR, progname, (int) getpid()); /* * These are all the things that are necessary! Optional ones should * be set in main before the options. they are tested below in * gen_config(). */ *pppd_cmd = '\0'; *chat_cmd = '\0'; idle_timeout = -1; autoreconnect_flag = -1; quality_interval = -1; quality_minlevel = -1; *announce_cmd = '\0'; *named_modifier_cmd = '\0'; *qtest_cmd = '\0'; *usecnt_cmd = '\0'; *news_cmd = '\0'; *misc_cmd = '\0'; *mail_cmd = '\0'; *port = '\0'; *netmask = '\0'; speed = -1; mtu = -1; mru = -1; ipc_mode = -1; ipc_owner = -1; ipc_group = -1; *login = '\0'; *password = '\0'; *telno = '\0'; debug(DBG_IGNORE, "init_config: removing old chatlines"); /*@@-compdestroy@@*/ for (linkaddr=strchnroot; linkaddr!=NULL; linkaddr=tmp) { free(linkaddr->str); tmp = linkaddr->nxt; free(linkaddr); } /*@@=compdestroy@@*/ strchnroot = NULL; state_cfgok = 0; } int load_config( char *fname, int level) { FILE *fp; char linebuf[PPPLCD_CFG_MAXSTRLEN]; int lineno; int rc; char *endcp, *valcp, *colcp, *cmdcp; struct strchnrec **linkaddrp; struct passwd *pwp; /*@@-mustfree@@*/ struct group *grpp; debug(DBG_FUNCS, "load_config: sof"); /* * Free up old storage of chatlines */ if (level == 0) init_config(); if ((fp=fopen(fname, "r")) == NULL) { warning("can't open %s", fname); return(1); } for (lineno=1; fgets(linebuf, (int) sizeof(linebuf), fp) != NULL; lineno++) { /* find the proper beginning of the line */ for (cmdcp=linebuf; *cmdcp && (*cmdcp=='\t' || *cmdcp==' '); cmdcp++) ; if (!*cmdcp) { continue; } else if (*cmdcp == '\n') { continue; } else if (*cmdcp == '#') { continue; } /* terminate the first word */ for (endcp=cmdcp; *endcp && *endcp!='\n' && *endcp!=':' && *endcp!=' ' && *endcp!='\t'; endcp++) ; if (*endcp == '\n' || !*endcp) { warning("no colon in line %d of file %s", lineno, fname); (void) fclose(fp); return(2); } else if (endcp == cmdcp) { warning("no command in line %d of file %s", lineno, fname); (void) fclose(fp); return(3); } /* but locate the colon first, 'cos terminating the first word may overwrite the colon and then we've lost it! */ for (colcp=endcp; *colcp && *colcp !=':'; colcp++) ; if (!*colcp) { warning("no colon in line %d of file %s", lineno, fname); (void) fclose(fp); return(4); } /* now go back and terminate the word */ *endcp = '\0'; /* find the first letter of the value */ for (valcp=colcp+1; *valcp && (*valcp=='\n' || *valcp=='\t' || *valcp==' '); valcp++) ; if (!*valcp) { warning("command without value at line %d of file %s", lineno, fname); (void) fclose(fp); return(5); } /* finally remove any trailing whitespace */ for (endcp=valcp+strlen(valcp)-1; endcp>valcp && (*endcp==' ' || *endcp=='\t' || *endcp=='\n'); endcp--) { ; } *(endcp+1) = '\0'; /* * Here list all optional and required config file entries */ if (strcmp(cmdcp, PPPLCD_CONF_KW_INCLUDE) == 0) { if ((rc=load_config(valcp, level+1)) != 0) { (void) fclose(fp); return(rc); } } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_UNIX_PPPD) == 0) { strcpy(pppd_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_UNIX_CHAT) == 0) { strcpy(chat_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_PPPD_DEBUG) == 0) { pppd_debug = atoi(valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_PPPD_KDEBUG) == 0) { pppd_kdebug = atoi(valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_MISC_TIMEOUT_IDLE) == 0) { idle_timeout = atoi(valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_PPPLCD_ANNOUNCE) == 0) { strcpy(announce_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_PPPLCD_NSSWITCH) == 0) { strcpy(named_modifier_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_PPPLCD_QUALITYTEST) == 0) { strcpy(qtest_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_PPPLCD_USECOUNT) == 0) { strcpy(usecnt_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_PPPLCD_MISC) == 0) { strcpy(misc_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_PPPLCD_XFER_NEWS) == 0) { strcpy(news_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_COMMAND_PPPLCD_XFER_MAIL) == 0) { strcpy(mail_cmd, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_CONNECT_LOGIN) == 0) { strcpy(login, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_CONNECT_PASSWORD) == 0) { strcpy(password, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_CONNECT_PHONENUMBER) == 0) { strcpy(telno, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_IP_NETMASK) == 0) { strcpy(netmask, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_IPC_MODE) == 0) { if (sscanf(valcp, "%i", &ipc_mode) != 1) { warning("%s: definition invalid", PPPLCD_CONF_KW_SETTING_IPC_MODE); (void) fclose(fp); return(10); } } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_IPC_OWNER) == 0) { if ((pwp=getpwnam(valcp)) != NULL) ipc_owner = pwp->pw_uid; } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_IPC_GROUP) == 0) { /* getgrnam(3) doesn't document if pointer needs user-freeing */ if ((grpp=getgrnam(valcp)) != NULL) ipc_group = grpp->gr_gid; } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_MISC_QUALITY) == 0) { if (sscanf(valcp, "%d %d", &quality_minlevel, &quality_interval) != 2) { warning("%s: definition invalid", PPPLCD_CONF_KW_SETTING_MISC_QUALITY); (void) fclose(fp); return(10); } } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_DEVICE_MODEM_DEVICE) == 0) { strcpy(port, valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_DEVICE_MODEM_SPEED) == 0) { speed = atoi(valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_IP_MTU) == 0) { mtu = atoi(valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_IP_MRU) == 0) { mru = atoi(valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_SETTING_MISC_AUTORECONNECT) == 0) { autoreconnect_flag = atoi(valcp); } else if (strcmp(cmdcp, PPPLCD_CONF_KW_CHATLINE) == 0) { for (linkaddrp=&strchnroot; *linkaddrp!=NULL; linkaddrp=&(*linkaddrp)->nxt) ; if ((*linkaddrp=(struct strchnrec *) malloc(sizeof(struct strchnrec))) == NULL) internal("(%s,%d) malloc failed"); /*@@-unrecog@@*/ if (((*linkaddrp)->str = strdup(valcp)) == NULL) /*@@=unrecog@@*/ internal("(%s,%d) malloc failed"); (*linkaddrp)->nxt = NULL; } else { warning("invalid command '%s' at line %d of file %s", cmdcp, lineno, fname); (void) fclose(fp); return(6); } } (void) fclose(fp); return(0); } gen_config() { static FILE *chat_fp; struct strchnrec *linkaddr; char valbuf[PPPLCD_CFG_MAXSTRLEN]; char *cp; mode_t old_umask; debug(DBG_FUNCS, "gen_config: sof"); state_cfgok = 0; old_umask = (mode_t) umask(077); delonexit(chatfile); if ((chat_fp=fopen(chatfile, "w")) == NULL) { warning("can't open %s: %s", chatfile, strerror(errno)); return(1); } (void) umask(old_umask); /* * Here check all required pars, set to special values in init_config() */ if (!*pppd_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_UNIX_PPPD); return(1); } else if (!*chat_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_UNIX_CHAT); return(1); } else if (autoreconnect_flag == -1) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_MISC_AUTORECONNECT); return(1); } else if (idle_timeout == -1) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_MISC_TIMEOUT_IDLE); return(1); } else if (!*qtest_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_QUALITYTEST); return(1); } else if (!*usecnt_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_USECOUNT); return(1); } else if (!*announce_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_ANNOUNCE); return(1); } else if (!*netmask) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_IP_NETMASK); return(1); } else if (!*port) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_DEVICE_MODEM_DEVICE); return(1); } else if (speed == -1) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_DEVICE_MODEM_SPEED); return(1); } else if (!*telno) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_CONNECT_PHONENUMBER); return(1); } else if (!*password) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_CONNECT_PASSWORD); return(1); } else if (!*login) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_CONNECT_LOGIN); return(1); } else if (pppd_kdebug < 0 || pppd_kdebug > 7) { warning("%s: out of range", PPPLCD_CONF_KW_SETTING_PPPD_KDEBUG); return(1); } else if (pppd_debug < 0 || pppd_debug > 1) { warning("%s: out of range", PPPLCD_CONF_KW_SETTING_PPPD_DEBUG); return(1); } else if (quality_minlevel == -1 || quality_interval == -1) { warning("%s: not defined", PPPLCD_CONF_KW_SETTING_MISC_QUALITY); return(1); } else if (strchnroot == NULL) { warning("no chat lines defined in config files"); return(1); } /* * Here generate the chat script */ for (linkaddr=strchnroot; linkaddr!=NULL; linkaddr=linkaddr->nxt) { debug(DBG_IGNORE, "gen_config: examining the chat strings"); strcpy(valbuf, linkaddr->str); if ((cp=strstr(valbuf, "%T")) != NULL && !*telno) { warning("chatline using %T with no telephone number defined yet"); (void) fclose(chat_fp); return(1); } else if (cp != NULL) { *(cp+1) = 's'; fprintf(chat_fp, valbuf, telno); } else if ((cp=strstr(valbuf, "%I")) != NULL && idle_timeout == -1) { warning("chatline using %I with no idle timeout defined yet"); (void) fclose(chat_fp); return(1); } else if (cp != NULL) { *(cp+1) = 'd'; fprintf(chat_fp, valbuf, idle_timeout); } else if ((cp=strstr(valbuf, "%L")) != NULL && !*login) { warning("chatline using %L with no login defined yet"); (void) fclose(chat_fp); return(1); } else if (cp != NULL) { *(cp+1) = 's'; fprintf(chat_fp, valbuf, login); } else if ((cp=strstr(valbuf, "%P")) != NULL && !*password) { warning("chatline using %P with no password defined yet"); (void) fclose(chat_fp); return(1); } else if (cp != NULL) { *(cp+1) = 's'; fprintf(chat_fp, valbuf, password); } else { fprintf(chat_fp, valbuf); } fprintf(chat_fp, "\n"); } (void) fclose(chat_fp); /* * Here we insert other '%' things into the appropriate command strings. */ /* * Here make any adjustments to values and give any warnings about * ranges etc. */ if (ipc_mode == -1) { warning("%s: not defined, defaulting to 0700", PPPLCD_CONF_KW_SETTING_IPC_MODE); ipc_mode = 0700; } if (ipc_owner == -1) { warning("%s: not defined, defaulting to root ownership", PPPLCD_CONF_KW_SETTING_IPC_OWNER); ipc_owner = 0; } if (ipc_group == -1) { warning("%s: not defined, defaulting to root groupship", PPPLCD_CONF_KW_SETTING_IPC_GROUP); ipc_group = 0; } if (mtu == -1) { warning("%s: not defined, defaulting to 576", PPPLCD_CONF_KW_SETTING_IP_MTU); mtu = 576; } if (mru == -1) { warning("%s: not defined, defaulting to 576", PPPLCD_CONF_KW_SETTING_IP_MRU); mru = 576; } if (!*misc_cmd) warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_MISC); if (!*news_cmd) warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_XFER_NEWS); if (!*mail_cmd) warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_XFER_MAIL); if (!*named_modifier_cmd) warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_NSSWITCH); if (pppd_kdebug && !pppd_debug) { warning("pppd-kdebug is set, setting ppp-debug too"); pppd_debug = 1; } /* * Flag that config has been successfully loaded - we may go ahead and * connect if we wish. */ state_cfgok = 1; return(0); } @ 1.12 log @RCS Id is now Header lock file is delonexit()ed @ text @d12 6 a17 6 char chatfile[64]; char qtest_cmd[256]; char usecnt_cmd[256]; char news_cmd[128]; char misc_cmd[128]; char mail_cmd[128]; d22 1 a22 1 static char *ppplcd_cfg_c_rcs_id = "$Header: ppplcd_cfg.c,v 1.11 1998/10/17 12:56:23 alexis Exp alexis $"; a58 1 *newshost = '\0'; d86 1 a86 1 char linebuf[128]; a215 3 } else if (strcmp(cmdcp, "newshost") == 0) { strcpy(newshost, valcp); d285 1 a285 1 char valbuf[256]; a403 9 strcpy(valbuf, news_cmd); if ((cp=strstr(valbuf, "%N")) != NULL && !*newshost) { warning("%s line using %N with no newshost defined yet", PPPLCD_CONF_KW_COMMAND_PPPLCD_XFER_NEWS); return(1); } else if (cp != NULL) { *(cp+1) = 's'; sprintf(news_cmd, valbuf, newshost); } a436 12 /* * Note we now *DO* accept quality check intervals which can interfere * with the idle check. The reason is that if the idle check program * counts active connections then any pinging done by the quality * check program does not affect the idle count. (Also it's nice for * testing :-) We still warn the user as before, but we *DO* allow it * (i.e. we don't return from this function before flagging a valid config. */ if (quality_interval != 0 && idle_timeout != 0 && quality_interval < 2*idle_timeout) warning("quality interval is low; quality checks may interfere with idle timeouts"); @ 1.11 log @made a few config commands optional @ text @d22 1 a22 1 static char *ppplcd_cfg_c_rcs_id = "$Id: ppplcd_cfg.c,v 1.10 1998/10/07 16:26:26 alexis Exp alexis $"; d297 1 @ 1.10 log @delinted moved extern declarations out added nsswitcher support added better validation on ipc mode, group name, user name @ text @d22 1 a22 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.9 1998/08/28 13:12:12 alexis Exp alexis $"; a324 9 } else if (!*misc_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_MISC); return(1); } else if (!*news_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_XFER_NEWS); return(1); } else if (!*mail_cmd) { warning("%s: not defined", PPPLCD_CONF_KW_COMMAND_PPPLCD_XFER_MAIL); return(1); d441 6 d448 1 a448 1 warning("%s: not defined, there will be no change in name lookup policy on connect", PPPLCD_CONF_KW_COMMAND_PPPLCD_NSSWITCH); @ 1.9 log @milepost @ text @d8 1 a11 9 /* extern char pppd_cmd[]; */ extern char chat_cmd[]; extern char announce_cmd[]; extern char port[]; extern char newshost[]; extern char netmask[]; extern int speed; extern int mtu; extern int mru; a17 8 extern char login[]; extern char password[]; extern char telno[]; extern int idle_timeout; extern int quality_interval; extern int quality_minlevel; extern int state_cfgok; extern int autoreconnect_flag; d21 2 a22 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.8 1998/08/07 11:28:42 alexis Exp $"; d31 1 a31 1 init_config() d37 1 a37 1 sprintf(chatfile, "%s/%s.%d.chat", TMP_DIR, progname, getpid()); d52 1 d71 1 d77 1 a88 1 char *cp; d93 1 a93 1 struct group *grpp; d109 1 a109 1 for (lineno=1; fgets(linebuf, sizeof(linebuf), fp) != NULL; lineno++) { d127 1 a127 1 fclose(fp); d131 1 a131 1 fclose(fp); d141 1 a141 1 fclose(fp); d152 1 a152 1 fclose(fp); d168 1 a168 1 fclose(fp); d190 3 d224 5 a228 1 sscanf(valcp, "%i", &ipc_mode); d235 2 d241 5 a245 1 sscanf(valcp, "%d %d", &quality_minlevel, &quality_interval); d267 1 d269 1 d275 1 a275 1 fclose(fp); d280 1 a280 1 fclose(fp); d291 1 a291 1 int old_umask; d296 1 a296 1 old_umask = umask(077); d298 2 a299 2 warning("can't open %s: %s", chatfile, strerror[errno]); return; d301 1 a301 1 umask(old_umask); d309 1 a309 1 return; d312 1 a312 1 return; d315 1 a315 1 return; d318 1 a318 1 return; d321 1 a321 1 return; d324 1 a324 1 return; d327 1 a327 1 return; d330 1 a330 1 return; d333 1 a333 1 return; d336 1 a336 1 return; d339 1 a339 1 return; d342 1 a342 1 return; d345 1 a345 1 return; d348 1 a348 1 return; d351 1 a351 1 return; d354 1 a354 1 return; d357 1 a357 1 return; d360 1 a360 1 return; d363 1 a363 1 return; d366 1 a366 1 return; d378 2 a379 2 fclose(chat_fp); return; d385 2 a386 2 fclose(chat_fp); return; d392 2 a393 2 fclose(chat_fp); return; d399 2 a400 2 fclose(chat_fp); return; d409 1 a409 1 fclose(chat_fp); d419 1 a419 1 return; d450 2 d476 1 @ 1.8 log @milepost - seems to work ok, though few messages seem wrong @ text @a22 4 char sndmail_cmd[128]; char sndnews_cmd[128]; char getmail_cmd[128]; char getnews_cmd[128]; d24 1 d37 1 a37 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.7 1997/11/11 11:57:25 alexis Exp $"; a68 2 *getmail_cmd = '\0'; *getnews_cmd = '\0'; d70 1 a71 2 *sndmail_cmd = '\0'; *sndnews_cmd = '\0'; d78 1 a78 1 ipc_perms = -1; d179 1 a179 1 if (strcmp(cmdcp, "include") == 0) { d185 1 a185 1 } else if (strcmp(cmdcp, "pppd") == 0) { d188 1 a188 1 } else if (strcmp(cmdcp, "chat") == 0) { d191 1 a191 1 } else if (strcmp(cmdcp, "pppd-debug") == 0) { d194 1 a194 1 } else if (strcmp(cmdcp, "pppd-kdebug") == 0) { d197 1 a197 1 } else if (strcmp(cmdcp, "idle") == 0) { d200 1 a200 1 } else if (strcmp(cmdcp, "announce") == 0) { d203 1 a203 1 } else if (strcmp(cmdcp, "qtest") == 0) { d206 1 a206 1 } else if (strcmp(cmdcp, "usecnt") == 0) { d209 2 a210 2 } else if (strcmp(cmdcp, "sndmail") == 0) { strcpy(sndmail_cmd, valcp); d212 1 a212 10 } else if (strcmp(cmdcp, "getmail") == 0) { strcpy(getmail_cmd, valcp); } else if (strcmp(cmdcp, "sndnews") == 0) { strcpy(sndnews_cmd, valcp); } else if (strcmp(cmdcp, "getnews") == 0) { strcpy(getnews_cmd, valcp); } else if (strcmp(cmdcp, "news") == 0) { d215 1 a215 1 } else if (strcmp(cmdcp, "mail") == 0) { d218 1 a218 1 } else if (strcmp(cmdcp, "login") == 0) { d221 1 a221 1 } else if (strcmp(cmdcp, "password") == 0) { d224 1 a224 1 } else if (strcmp(cmdcp, "telno") == 0) { a226 3 } else if (strcmp(cmdcp, "port") == 0) { strcpy(port, valcp); d230 1 a230 1 } else if (strcmp(cmdcp, "netmask") == 0) { d233 2 a234 2 } else if (strcmp(cmdcp, "ipc_perms") == 0) { sscanf(valcp, "%i", &ipc_perms); d236 1 a236 1 } else if (strcmp(cmdcp, "ipc_owner") == 0) { d240 1 a240 1 } else if (strcmp(cmdcp, "ipc_group") == 0) { d244 1 a244 1 } else if (strcmp(cmdcp, "quality") == 0) { d247 4 a250 1 } else if (strcmp(cmdcp, "speed") == 0) { d253 1 a253 1 } else if (strcmp(cmdcp, "mtu") == 0) { d256 1 a256 1 } else if (strcmp(cmdcp, "mru") == 0) { d259 1 a259 1 } else if (strcmp(cmdcp, "autoreconnect") == 0) { d262 1 a262 1 } else if (strcmp(cmdcp, "chatline") == 0) { d306 1 a306 1 warning("pppd not defined in config files"); d309 1 a309 1 warning("chat not defined in config files"); d312 1 a312 1 warning("autoreconnect not defined in config files"); d315 1 a315 1 warning("idle not defined in config files"); d318 1 a318 1 warning("qtest command not defined in config files"); d321 1 a321 4 warning("usecnt command not defined in config files"); return; } else if (!*sndmail_cmd) { warning("sndmail command not defined in config files"); d323 2 a324 8 } else if (!*sndnews_cmd) { warning("sndnews command not defined in config files"); return; } else if (!*getmail_cmd) { warning("getmail command not defined in config files"); return; } else if (!*getnews_cmd) { warning("getnews command not defined in config files"); d327 1 a327 1 warning("news command not defined in config files"); d330 1 a330 1 warning("mail command not defined in config files"); d333 1 a333 1 warning("announce command not defined in config files"); d336 1 a336 1 warning("netmask not defined in config files"); d339 4 a342 1 warning("port not defined in config files"); d345 1 a345 1 warning("telno not defined in config files"); d348 1 a348 1 warning("password not defined in config files"); d351 1 a351 7 warning("login not defined in config files"); return; } else if (speed == -1) { warning("speed not defined in config files"); return; } else if (strchnroot == NULL) { warning("no chat lines defined in config files"); d354 1 a354 1 warning("pppd-kdebug out of range"); d357 1 a357 1 warning("pppd-debug out of range"); d359 2 a360 2 } else if (quality_minlevel == -1) { warning("quality level not defined in config files"); d362 2 a363 2 } else if (quality_interval == -1) { warning("quality interval not defined in config files"); a413 18 strcpy(valbuf, getnews_cmd); if ((cp=strstr(valbuf, "%N")) != NULL && !*newshost) { warning("sndnews line using %N with no newshost defined yet"); return; } else if (cp != NULL) { *(cp+1) = 's'; sprintf(getnews_cmd, valbuf, newshost); } strcpy(valbuf, sndnews_cmd); if ((cp=strstr(valbuf, "%N")) != NULL && !*newshost) { warning("sndnews line using %N with no newshost defined yet"); return; } else if (cp != NULL) { *(cp+1) = 's'; sprintf(sndnews_cmd, valbuf, newshost); } d416 1 a416 1 warning("news line using %N with no newshost defined yet"); d428 3 a430 3 if (ipc_perms == -1) { warning("ipc_perms not set, defaulting to 0700"); ipc_perms = 0700; d433 1 a433 1 warning("ipc_owner not set, defaulting to 'root'"); d437 1 a437 1 warning("ipc_group not set, defaulting to 'root'"); d441 1 a441 1 warning("MTU not set, defaulting to 576"); d445 1 a445 1 warning("MRU not set, defaulting to 576"); @ 1.7 log @ppplcd_utils.h renamed quality check remote host and acceptable quality now specified on quality checking command's command line so no longer needed added support for config-specified mtu, mru, newshost @ text @d22 1 d27 2 d32 3 a34 4 extern int idlecheck_timeout; extern int idlecheck_interval; extern int qualitycheck_interval; extern int qualitycheck_interval; d36 1 a36 1 extern int on_remote_hangup_do_redial; d40 1 a40 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.6 1997/10/26 12:12:29 alexis Exp alexis $"; d65 4 a68 2 idlecheck_timeout = -1; qualitycheck_interval = -1; d71 1 d74 2 d204 1 a204 1 idlecheck_timeout = atoi(valcp); d212 3 d227 6 d262 3 d274 2 a275 2 } else if (strcmp(cmdcp, "rorh") == 0) { on_remote_hangup_do_redial = atoi(valcp); d326 4 a329 1 } else if (idlecheck_timeout == -1) { d335 3 d350 6 d386 7 a392 1 } d408 1 a408 1 } else if ((cp=strstr(valbuf, "%I")) != NULL && idlecheck_timeout == -1) { d414 1 a414 1 fprintf(chat_fp, valbuf, idlecheck_timeout); d459 9 d494 8 a501 8 if (qualitycheck_interval == -1) { info("qinterval not defined in config files, calculating"); qualitycheck_interval = 2 * idlecheck_timeout; } else if (qualitycheck_interval < 2*idlecheck_timeout && qualitycheck_interval != 0) { /* idle checks must fit entirely inside the quality check interval since the quality check alters the usage count */ warning("qinterval should be at least twice idle timeout!"); /* don't adjust it though */ } d503 2 a504 2 /* check the level every quarter of that interval - so a max idle of 1.25 * 300 - 1/inf */ idlecheck_interval = idlecheck_timeout / 4; @ 1.6 log @stamped for release 1.0.6 @ text @d3 1 a3 1 #include "ppplcd_utils.h" /* for debug funcs */ d15 1 a15 1 extern char qualitycheck_remhost[]; d18 2 d21 1 a21 1 char qtest_cmd[128]; a31 1 extern int qualitycheck_minquality; d38 1 a38 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.5 1997/10/20 16:59:18 alexis Exp alexis $"; a63 1 qualitycheck_minquality = -1; d72 1 a72 1 *qualitycheck_remhost = '\0'; d75 2 a198 3 } else if (strcmp(cmdcp, "quality") == 0) { qualitycheck_minquality = atoi(valcp); a225 3 } else if (strcmp(cmdcp, "qualitycheck_remhost") == 0) { strcpy(qualitycheck_remhost, valcp); d229 3 d249 6 a309 3 } else if (qualitycheck_minquality == -1) { warning("quality not defined in config files"); return; a330 3 } else if (!*qualitycheck_remhost) { warning("qualitycheck_remhost not defined in config files"); return; d399 23 d439 8 d451 1 a451 1 } else if (qualitycheck_interval < 2*idlecheck_timeout && qualitycheck_minquality != 0 && qualitycheck_interval != 0) { @ 1.5 log @modified function that generates chat script - so that it's unreadable @ text @d37 1 a37 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.4 1997/02/25 17:52:25 alexis Exp $"; @ 1.4 log @fsstnd conformancy abstracted xfer commands and added to config @ text @d37 1 a37 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.3 1997/02/21 17:05:13 alexis Exp alexis $"; d280 1 d285 1 d290 1 @ 1.3 log @suppport for ipc perms added @ text @d19 5 d37 1 a37 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.2 1997/02/09 16:00:50 alexis Exp alexis $"; d66 5 d203 15 d304 15 @ 1.2 log @More changes ... now works. @ text @d5 3 d9 1 d11 1 a11 1 extern char pppd_cmd[]; d32 1 a32 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.1 1997/02/01 21:52:17 alexis Exp alexis $"; d65 3 d92 2 d211 11 d361 13 @ 1.1 log @Initial revision @ text @d2 1 a2 1 #include /* for strstr() */ d4 1 d14 1 a14 1 extern char chatfile[]; d28 1 a28 1 static char *rcs_id = "$Id: ppplcd_cfg.c,v 1.2 1997/01/31 14:43:34 alexis Exp alexis $"; d240 1 a240 1 perror("fopen"); @