From: David F. Skoll Date: Wed, 27 Feb 2002 15:51:20 +0000 (+0000) Subject: Whitespace tidying. X-Git-Tag: ppp-2.4.7~444 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=79624399f8eb3d29ddca1b2cf919ef2362e33eb2 Whitespace tidying. --- diff --git a/pppd/plugins/radius/radiusclient/include/includes.h b/pppd/plugins/radius/radiusclient/include/includes.h index 4017919..856d9a8 100644 --- a/pppd/plugins/radius/radiusclient/include/includes.h +++ b/pppd/plugins/radius/radiusclient/include/includes.h @@ -1,15 +1,15 @@ /* - * $Id: includes.h,v 1.1 2002/01/22 16:03:01 dfs Exp $ + * $Id: includes.h,v 1.2 2002/02/27 15:51:19 dfs Exp $ * * Copyright (C) 1997 Lars Fenneberg * * Copyright 1992 Livingston Enterprises, Inc. * - * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan + * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan * and Merit Network, Inc. All Rights Reserved * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -137,7 +137,7 @@ int sigprocmask (int, sigset_t *, sigset_t *); * prefer srandom/random over srand/rand as there generator has a * better distribution of the numbers on certain systems. * on Linux both generators are identical. - */ + */ #ifndef HAVE_RANDOM # ifdef HAVE_RAND # define srandom srand diff --git a/pppd/plugins/radius/radiusclient/include/messages.h b/pppd/plugins/radius/radiusclient/include/messages.h index 23c4f67..d20ce29 100644 --- a/pppd/plugins/radius/radiusclient/include/messages.h +++ b/pppd/plugins/radius/radiusclient/include/messages.h @@ -1,15 +1,15 @@ /* - * $Id: messages.h,v 1.1 2002/01/22 16:03:01 dfs Exp $ + * $Id: messages.h,v 1.2 2002/02/27 15:51:19 dfs Exp $ * * Copyright (C) 1995,1996 Lars Fenneberg * * Copyright 1992 Livingston Enterprises, Inc. * - * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan + * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan * and Merit Network, Inc. All Rights Reserved * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -50,4 +50,4 @@ #define SC_STATUS_FAILED "RADIUS: Status failure\r\n" -#endif /* MESSAGES_H */ \ No newline at end of file +#endif /* MESSAGES_H */ diff --git a/pppd/plugins/radius/radiusclient/include/pathnames.h b/pppd/plugins/radius/radiusclient/include/pathnames.h index 2e6d219..ffe8c6c 100644 --- a/pppd/plugins/radius/radiusclient/include/pathnames.h +++ b/pppd/plugins/radius/radiusclient/include/pathnames.h @@ -1,15 +1,15 @@ /* - * $Id: pathnames.h,v 1.1 2002/01/22 16:03:01 dfs Exp $ + * $Id: pathnames.h,v 1.2 2002/02/27 15:51:19 dfs Exp $ * * Copyright (C) 1995,1996 Lars Fenneberg * * Copyright 1992 Livingston Enterprises, Inc. * - * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan + * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan * and Merit Network, Inc. All Rights Reserved * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -25,4 +25,4 @@ #define _PATH_ETC_RADIUSCLIENT_CONF "/etc/radiusclient.conf" #endif -#endif /* PATHNAMES_H */ \ No newline at end of file +#endif /* PATHNAMES_H */ diff --git a/pppd/plugins/radius/radiusclient/include/radiusclient.h b/pppd/plugins/radius/radiusclient/include/radiusclient.h index f5183fc..cff6822 100644 --- a/pppd/plugins/radius/radiusclient/include/radiusclient.h +++ b/pppd/plugins/radius/radiusclient/include/radiusclient.h @@ -1,15 +1,15 @@ /* - * $Id: radiusclient.h,v 1.1 2002/01/22 16:03:01 dfs Exp $ + * $Id: radiusclient.h,v 1.2 2002/02/27 15:51:19 dfs Exp $ * * Copyright (C) 1995,1996,1997,1998 Lars Fenneberg * * Copyright 1992 Livingston Enterprises, Inc. * - * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan + * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan * and Merit Network, Inc. All Rights Reserved * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -39,7 +39,7 @@ #endif typedef unsigned long UINT4; -typedef long INT4; +typedef long INT4; #define AUTH_VECTOR_LEN 16 #define AUTH_PASS_LEN (3 * 16) /* multiple of 16 */ @@ -67,7 +67,7 @@ typedef long INT4; typedef struct server { int max; char *name[SERVER_MAX]; - unsigned short port[SERVER_MAX]; + unsigned short port[SERVER_MAX]; } SERVER; typedef struct pw_auth_hdr @@ -260,7 +260,7 @@ typedef struct pw_auth_hdr #define PW_CALLBACK 16 #define PW_USER_ERROR 17 #define PW_HOST_REQUEST 18 - + /* NAS PORT TYPES */ #define PW_ASYNC 0 @@ -285,7 +285,7 @@ typedef struct dict_attr char name[NAME_LENGTH + 1]; /* attribute name */ int value; /* attribute index */ int type; /* string, int, etc. */ - int vendorcode; /* vendor code */ + int vendorcode; /* vendor code */ struct dict_attr *next; } DICT_ATTR; @@ -309,7 +309,7 @@ typedef struct value_pair { char name[NAME_LENGTH + 1]; int attribute; - int vendorcode; + int vendorcode; int type; UINT4 lvalue; char strvalue[AUTH_STRING_LEN + 1]; @@ -319,7 +319,7 @@ typedef struct value_pair /* don't change this, as it has to be the same as in the Merit radiusd code */ #define MGMT_POLL_SECRET "Hardlyasecret" -/* Define return codes from "SendServer" utility */ +/* Define return codes from "SendServer" utility */ #define BADRESP_RC -2 #define ERROR_RC -1 diff --git a/pppd/plugins/radius/radiusclient/lib/clientid.c b/pppd/plugins/radius/radiusclient/lib/clientid.c index e86cac0..f15084b 100644 --- a/pppd/plugins/radius/radiusclient/lib/clientid.c +++ b/pppd/plugins/radius/radiusclient/lib/clientid.c @@ -1,10 +1,10 @@ /* - * $Id: clientid.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: clientid.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1995,1996,1997 Lars Fenneberg * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -20,7 +20,7 @@ struct map2id_s { struct map2id_s *next; }; -static struct map2id_s *map2id_list = NULL; +static struct map2id_s *map2id_list = NULL; /* * Function: rc_read_mapfile @@ -29,7 +29,7 @@ static struct map2id_s *map2id_list = NULL; * * Arguments: the file name of the map file * - * Returns: zero on success, negative integer on failure + * Returns: zero on success, negative integer on failure */ int rc_read_mapfile(char *filename) @@ -40,51 +40,51 @@ int rc_read_mapfile(char *filename) struct map2id_s *p; int lnr = 0; - if ((mapfd = fopen(filename,"r")) == NULL) - { - rc_log(LOG_ERR,"rc_read_mapfile: can't read %s: %s", filename, strerror(errno)); + if ((mapfd = fopen(filename,"r")) == NULL) + { + rc_log(LOG_ERR,"rc_read_mapfile: can't read %s: %s", filename, strerror(errno)); return (-1); } - + #define SKIP(p) while(*p && isspace(*p)) p++; - while (fgets(buffer, sizeof(buffer), mapfd) != NULL) - { - lnr++; - + while (fgets(buffer, sizeof(buffer), mapfd) != NULL) + { + lnr++; + q = buffer; - - SKIP(q); - - if ((*q == '\n') || (*q == '#') || (*q == '\0')) + + SKIP(q); + + if ((*q == '\n') || (*q == '#') || (*q == '\0')) continue; if (( c = strchr(q, ' ')) || (c = strchr(q,'\t'))) { *c = '\0'; c++; SKIP(c); - + name = q; id = c; - + if ((p = (struct map2id_s *)malloc(sizeof(*p))) == NULL) { rc_log(LOG_CRIT,"rc_read_mapfile: out of memory"); return (-1); } - + p->name = strdup(name); p->id = atoi(id); p->next = map2id_list; - map2id_list = p; - + map2id_list = p; + } else { - - rc_log(LOG_ERR, "rc_read_mapfile: malformed line in %s, line %d", filename, lnr); + + rc_log(LOG_ERR, "rc_read_mapfile: malformed line in %s, line %d", filename, lnr); return (-1); } } - + #undef SKIP fclose(mapfd); @@ -110,13 +110,13 @@ UINT4 rc_map2id(char *name) *ttyname = '\0'; if (*name != '/') strcpy(ttyname, "/dev/"); - + strncat(ttyname, name, sizeof(ttyname)); - + for(p = map2id_list; p; p = p->next) if (!strcmp(ttyname, p->name)) return p->id; rc_log(LOG_WARNING,"rc_map2id: can't find tty %s in map database", ttyname); - + return 0; } diff --git a/pppd/plugins/radius/radiusclient/lib/config.c b/pppd/plugins/radius/radiusclient/lib/config.c index 0b78c86..724edbe 100644 --- a/pppd/plugins/radius/radiusclient/lib/config.c +++ b/pppd/plugins/radius/radiusclient/lib/config.c @@ -1,15 +1,15 @@ /* - * $Id: config.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: config.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1995,1996,1997 Lars Fenneberg * * Copyright 1992 Livingston Enterprises, Inc. * - * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan + * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan * and Merit Network, Inc. All Rights Reserved * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -28,7 +28,7 @@ static int test_config(char *); * * Returns: pointer to option on success, NULL otherwise */ - + static OPTION *find_option(char *optname, unsigned int type) { int i; @@ -37,7 +37,7 @@ static OPTION *find_option(char *optname, unsigned int type) for (i = 0; i < num_options; i++) { if (!strcmp(config_options[i].name, optname) && (config_options[i].type & type)) - return &config_options[i]; + return &config_options[i]; } return NULL; @@ -52,7 +52,7 @@ static OPTION *find_option(char *optname, unsigned int type) */ static int set_option_str(char *filename, int line, OPTION *option, char *p) -{ +{ if (p) option->val = (void *) strdup(p); else @@ -74,8 +74,8 @@ static int set_option_int(char *filename, int line, OPTION *option, char *p) rc_log(LOG_CRIT, "read_config: out of memory"); return (-1); } - - *iptr = atoi(p); + + *iptr = atoi(p); option->val = (void *) iptr; return 0; @@ -144,7 +144,7 @@ static int set_option_auo(char *filename, int line, OPTION *option, char *p) rc_log(LOG_CRIT, "read_config: out of memory"); return (-1); } - + *iptr = 0; p = strtok(p, ", \t"); @@ -154,19 +154,19 @@ static int set_option_auo(char *filename, int line, OPTION *option, char *p) *iptr = AUTH_RADIUS_FST; else { rc_log(LOG_ERR,"%s: auth_order: unknown keyword: %s", filename, p); - return (-1); + return (-1); } - + p = strtok(NULL, ", \t"); - + if (p && (*p != '\0')) { if ((*iptr & AUTH_RADIUS_FST) && !strcmp(p, "local")) *iptr = (*iptr) | AUTH_LOCAL_SND; else if ((*iptr & AUTH_LOCAL_FST) && !strcmp(p, "radius")) - *iptr = (*iptr) | AUTH_RADIUS_SND; + *iptr = (*iptr) | AUTH_RADIUS_SND; else { rc_log(LOG_ERR,"%s: auth_order: unknown or unexpected keyword: %s", filename, p); - return (-1); + return (-1); } } @@ -180,7 +180,7 @@ static int set_option_auo(char *filename, int line, OPTION *option, char *p) * Function: rc_read_config * * Purpose: read the global config file - * + * * Returns: 0 on success, -1 when failure */ @@ -202,20 +202,20 @@ int rc_read_config(char *filename) { line++; p = buffer; - + if ((*p == '\n') || (*p == '#') || (*p == '\0')) continue; p[strlen(p)-1] = '\0'; - - + + if ((pos = strcspn(p, "\t ")) == 0) { rc_log(LOG_ERR, "%s: line %d: bogus format: %s", filename, line, p); return (-1); - } - + } + p[pos] = '\0'; - + if ((option = find_option(p, OT_ANY)) == NULL) { rc_log(LOG_ERR, "%s: line %d: unrecognized keyword: %s", filename, line, p); return (-1); @@ -227,25 +227,25 @@ int rc_read_config(char *filename) } p += pos+1; - while (isspace(*p)) + while (isspace(*p)) p++; switch (option->type) { case OT_STR: if (set_option_str(filename, line, option, p) < 0) - return (-1); - break; + return (-1); + break; case OT_INT: if (set_option_int(filename, line, option, p) < 0) - return (-1); + return (-1); break; case OT_SRV: if (set_option_srv(filename, line, option, p) < 0) - return (-1); + return (-1); break; case OT_AUO: if (set_option_auo(filename, line, option, p) < 0) - return (-1); + return (-1); break; default: rc_log(LOG_CRIT, "rc_read_config: impossible case branch!"); @@ -261,7 +261,7 @@ int rc_read_config(char *filename) * Function: rc_conf_str, rc_conf_int, rc_conf_src * * Purpose: get the value of a config option - * + * * Returns: config option value */ @@ -270,9 +270,9 @@ char *rc_conf_str(char *optname) OPTION *option; option = find_option(optname, OT_STR); - + if (option != NULL) { - return (char *)option->val; + return (char *)option->val; } else { rc_log(LOG_CRIT, "rc_conf_str: unkown config option requested: %s", optname); abort(); @@ -284,9 +284,9 @@ int rc_conf_int(char *optname) OPTION *option; option = find_option(optname, OT_INT|OT_AUO); - + if (option != NULL) { - return *((int *)option->val); + return *((int *)option->val); } else { rc_log(LOG_CRIT, "rc_conf_int: unkown config option requested: %s", optname); abort(); @@ -298,9 +298,9 @@ SERVER *rc_conf_srv(char *optname) OPTION *option; option = find_option(optname, OT_SRV); - + if (option != NULL) { - return (SERVER *)option->val; + return (SERVER *)option->val; } else { rc_log(LOG_CRIT, "rc_conf_srv: unkown config option requested: %s", optname); abort(); @@ -336,7 +336,7 @@ static int test_config(char *filename) { rc_log(LOG_ERR,"%s: no servers file specified", filename); return (-1); - } + } if (!rc_conf_str("dictionary")) { rc_log(LOG_ERR,"%s: no dictionary specified", filename); @@ -348,11 +348,11 @@ static int test_config(char *filename) rc_log(LOG_ERR,"%s: radius_timeout <= 0 is illegal", filename); return (-1); } - if (rc_conf_int("radius_retries") <= 0) + if (rc_conf_int("radius_retries") <= 0) { rc_log(LOG_ERR,"%s: radius_retries <= 0 is illegal", filename); return (-1); - } + } #if 0 file = rc_conf_str("login_local"); @@ -378,32 +378,32 @@ static int test_config(char *filename) return (-1); } #endif - + if (rc_conf_int("login_tries") <= 0) { rc_log(LOG_ERR,"%s: login_tries <= 0 is illegal", filename); return (-1); - } + } if (rc_conf_str("seqfile") == NULL) { rc_log(LOG_ERR,"%s: seqfile not specified", filename); return (-1); - } + } if (rc_conf_int("login_timeout") <= 0) { rc_log(LOG_ERR,"%s: login_timeout <= 0 is illegal", filename); return (-1); - } + } if (rc_conf_str("mapfile") == NULL) { rc_log(LOG_ERR,"%s: mapfile not specified", filename); return (-1); - } + } if (rc_conf_str("nologin") == NULL) { rc_log(LOG_ERR,"%s: nologin not specified", filename); return (-1); - } + } return 0; } @@ -446,7 +446,7 @@ static int find_match (UINT4 *ip_addr, char *hostname) } } return (-1); -} +} /* * Function: rc_find_server @@ -456,10 +456,10 @@ static int find_match (UINT4 *ip_addr, char *hostname) * Returns: 0 on success, -1 on failure * */ - + int rc_find_server (char *server_name, UINT4 *ip_addr, char *secret) { - UINT4 myipaddr = 0; + UINT4 myipaddr = 0; int len; int result; FILE *clientfd; @@ -478,7 +478,7 @@ int rc_find_server (char *server_name, UINT4 *ip_addr, char *secret) rc_log(LOG_ERR, "rc_find_server: couldn't open file: %s: %s", strerror(errno), rc_conf_str("servers")); return (-1); } - + if ((myipaddr = rc_own_ipaddress()) == 0) return (-1); diff --git a/pppd/plugins/radius/radiusclient/lib/env.c b/pppd/plugins/radius/radiusclient/lib/env.c index f3d177b..5132b1b 100644 --- a/pppd/plugins/radius/radiusclient/lib/env.c +++ b/pppd/plugins/radius/radiusclient/lib/env.c @@ -1,10 +1,10 @@ /* - * $Id: env.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: env.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1995,1996,1997 Lars Fenneberg * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -19,7 +19,7 @@ * Purpose: allocate space for a new environment * */ - + ENV *rc_new_env(int size) { ENV *p; @@ -29,19 +29,19 @@ ENV *rc_new_env(int size) if ((p = malloc(sizeof(*p))) == NULL) return NULL; - + if ((p->env = malloc(size * sizeof(char *))) == NULL) { rc_log(LOG_CRIT, "rc_new_env: out of memory"); free(p); return NULL; - } + } p->env[0] = NULL; - + p->size = 0; - p->maxsize = size; - + p->maxsize = size; + return p; } @@ -51,11 +51,11 @@ ENV *rc_new_env(int size) * Purpose: free the space used by an env structure * */ - + void rc_free_env(ENV *env) { free(env->env); - free(env); + free(env); } /* @@ -64,7 +64,7 @@ void rc_free_env(ENV *env) * Purpose: add an environment entry * */ - + int rc_add_env(ENV *env, char *name, char *value) { int i; @@ -73,7 +73,7 @@ int rc_add_env(ENV *env, char *name, char *value) for (i = 0; env->env[i] != NULL; i++) { if (strncmp(env->env[i], name, MAX(strchr(env->env[i], '=') - env->env[i],strlen(name))) == 0) - break; + break; } if (env->env[i]) @@ -89,20 +89,20 @@ int rc_add_env(ENV *env, char *name, char *value) rc_log(LOG_CRIT, "rc_add_env: not enough space for environment (increase ENV_SIZE)"); return (-1); } - + if ((env->env[env->size] = malloc(strlen(name)+strlen(value)+2)) == NULL) { rc_log(LOG_CRIT, "rc_add_env: out of memory"); return (-1); } - + sprintf(env->env[env->size],"%s=%s", name, value); - + env->size++; env->env[env->size] = NULL; } - return 0; + return 0; } /* @@ -111,21 +111,21 @@ int rc_add_env(ENV *env, char *name, char *value) * Purpose: imports an array of null-terminated strings * */ - + int rc_import_env(ENV *env, char **import) { char *es; - + while (*import) { es = strchr(*import, '='); - + if (!es) { import++; continue; } - + /* ok, i grant thats not very clean... */ *es = '\0'; @@ -134,11 +134,11 @@ int rc_import_env(ENV *env, char **import) *es = '='; return (-1); } - + *es = '='; - + import++; } - + return 0; } diff --git a/pppd/plugins/radius/radiusclient/lib/ip_util.c b/pppd/plugins/radius/radiusclient/lib/ip_util.c index f207b0c..3a26d13 100644 --- a/pppd/plugins/radius/radiusclient/lib/ip_util.c +++ b/pppd/plugins/radius/radiusclient/lib/ip_util.c @@ -1,15 +1,15 @@ /* - * $Id: ip_util.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: ip_util.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1995,1996,1997 Lars Fenneberg * * Copyright 1992 Livingston Enterprises, Inc. * - * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan + * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan * and Merit Network, Inc. All Rights Reserved * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -41,7 +41,7 @@ UINT4 rc_get_ipaddr (char *host) return ((UINT4) 0); } return ntohl((*(UINT4 *) hp->h_addr)); -} +} /* * Function: rc_good_ipaddr @@ -100,7 +100,7 @@ int rc_good_ipaddr (char *addr) * for the supplied IP address. * */ - + const char *rc_ip_hostname (UINT4 h_ipaddr) { struct hostent *hp; @@ -110,9 +110,9 @@ const char *rc_ip_hostname (UINT4 h_ipaddr) AF_INET)) == NULL) { rc_log(LOG_ERR,"rc_ip_hostname: couldn't look up host by addr: %08lX", h_ipaddr); } - + return ((hp==NULL)?"unknown":hp->h_name); -} +} /* * Function: rc_getport @@ -170,7 +170,7 @@ rc_own_hostname(char *hostname, int len) } #else return -1; -#endif +#endif return 0; } @@ -196,7 +196,7 @@ UINT4 rc_own_ipaddress(void) rc_log(LOG_ERR, "rc_own_ipaddress: couldn't get own IP address"); return 0; } - } - + } + return this_host_ipaddr; } diff --git a/pppd/plugins/radius/radiusclient/lib/lock.c b/pppd/plugins/radius/radiusclient/lib/lock.c index f78c592..83f79d8 100644 --- a/pppd/plugins/radius/radiusclient/lib/lock.c +++ b/pppd/plugins/radius/radiusclient/lib/lock.c @@ -1,10 +1,10 @@ /* - * $Id: lock.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: lock.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1997 Lars Fenneberg * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -30,15 +30,15 @@ int do_lock_exclusive(int fd) { flock_t fl; int res; - + memset((void *)&fl, 0, sizeof(fl)); - + fl.l_type = F_WRLCK; fl.l_whence = fl.l_start = 0; fl.l_len = 0; /* 0 means "to end of file" */ res = fcntl(fd, F_SETLK, &fl); - + if ((res == -1) && (errno == EAGAIN)) errno = EWOULDBLOCK; @@ -48,9 +48,9 @@ int do_lock_exclusive(int fd) int do_unlock(int fd) { flock_t fl; - + memset((void *)&fl, 0, sizeof(fl)); - + fl.l_type = F_UNLCK; fl.l_whence = fl.l_start = 0; fl.l_len = 0; /* 0 means "to end of file" */ @@ -61,4 +61,3 @@ int do_unlock(int fd) #else YOU_LOOSE "need either flock(2) or fcntl(2)" #endif - diff --git a/pppd/plugins/radius/radiusclient/lib/log.c b/pppd/plugins/radius/radiusclient/lib/log.c index 9e922a3..917b907 100644 --- a/pppd/plugins/radius/radiusclient/lib/log.c +++ b/pppd/plugins/radius/radiusclient/lib/log.c @@ -1,10 +1,10 @@ /* - * $Id: log.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: log.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1995,1996,1997 Lars Fenneberg * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -44,10 +44,10 @@ void rc_log(int prio, const char *format, ...) { char buff[1024]; va_list ap; - + va_start(ap,format); vsnprintf(buff, sizeof(buff), format, ap); va_end(ap); - + syslog(prio, "%s", buff); } diff --git a/pppd/plugins/radius/radiusclient/lib/md5.c b/pppd/plugins/radius/radiusclient/lib/md5.c index 5dc7652..07c6cee 100644 --- a/pppd/plugins/radius/radiusclient/lib/md5.c +++ b/pppd/plugins/radius/radiusclient/lib/md5.c @@ -1,5 +1,5 @@ /* - * $Id: md5.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: md5.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ */ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm @@ -144,8 +144,8 @@ static void MD5Init (MD5_CTX *context) static void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen) { unsigned int i, - index, - partLen; + index, + partLen; /* Compute number of bytes mod 64 */ index = (unsigned int) ((context->count[0] >> 3) & 0x3F); @@ -188,7 +188,7 @@ static void MD5Final (unsigned char *digest, MD5_CTX *context) { unsigned char bits[8]; unsigned int index, - padLen; + padLen; /* Save number of bits */ Encode (bits, context->count, 8); @@ -217,10 +217,10 @@ static void MD5Final (unsigned char *digest, MD5_CTX *context) static void MD5Transform (UINT4 *state, unsigned char *block) { UINT4 a = state[0], - b = state[1], - c = state[2], - d = state[3], - x[16]; + b = state[1], + c = state[2], + d = state[3], + x[16]; Decode (x, block, 64); @@ -313,7 +313,7 @@ static void MD5Transform (UINT4 *state, unsigned char *block) static void Encode (unsigned char *output, UINT4 *input, unsigned int len) { unsigned int i, - j; + j; for (i = 0, j = 0; j < len; i++, j += 4) { @@ -330,7 +330,7 @@ static void Encode (unsigned char *output, UINT4 *input, unsigned int len) static void Decode (UINT4 *output, unsigned char *input, unsigned int len) { unsigned int i, - j; + j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4) input[j]) | (((UINT4) input[j + 1]) << 8) | diff --git a/pppd/plugins/radius/radiusclient/lib/memcmp.c b/pppd/plugins/radius/radiusclient/lib/memcmp.c index d0d86e0..3c2b1cb 100644 --- a/pppd/plugins/radius/radiusclient/lib/memcmp.c +++ b/pppd/plugins/radius/radiusclient/lib/memcmp.c @@ -1,5 +1,5 @@ /* - * $Id: memcmp.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: memcmp.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Taken from the Linux kernel. GPL applies. * Copyright (C) 1991, 1992 Linus Torvalds @@ -13,10 +13,9 @@ int memcmp(const void * cs,const void * ct,size_t count) { const unsigned char *su1, *su2; signed char res = 0; - + for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) if ((res = *su1 - *su2) != 0) break; - return res; + return res; } - \ No newline at end of file diff --git a/pppd/plugins/radius/radiusclient/lib/strcasecmp.c b/pppd/plugins/radius/radiusclient/lib/strcasecmp.c index 190da22..f94dde6 100644 --- a/pppd/plugins/radius/radiusclient/lib/strcasecmp.c +++ b/pppd/plugins/radius/radiusclient/lib/strcasecmp.c @@ -1,11 +1,11 @@ /* - * $Id: strcasecmp.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: strcasecmp.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1996 Lars Fenneberg and Christian Graefe * - * This file is provided under the terms and conditions of the GNU general - * public license, version 2 or any later version, incorporated herein by - * reference. + * This file is provided under the terms and conditions of the GNU general + * public license, version 2 or any later version, incorporated herein by + * reference. * */ @@ -26,11 +26,11 @@ int strcasecmp(char *s1, char *s2) { while (*s1 && *s2 && toupper(*s1) == toupper(*s2)) - s1++, s2++; - + s1++, s2++; + if (!*s1 && !*s2) - return 0; + return 0; else - return (toupper(*s1) - toupper(*s2)); + return (toupper(*s1) - toupper(*s2)); } #endif diff --git a/pppd/plugins/radius/radiusclient/lib/strdup.c b/pppd/plugins/radius/radiusclient/lib/strdup.c index 0c487bf..bf923e8 100644 --- a/pppd/plugins/radius/radiusclient/lib/strdup.c +++ b/pppd/plugins/radius/radiusclient/lib/strdup.c @@ -1,11 +1,11 @@ /* - * $Id: strdup.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: strdup.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1996 Lars Fenneberg and Christian Graefe * - * This file is provided under the terms and conditions of the GNU general - * public license, version 2 or any later version, incorporated herein by - * reference. + * This file is provided under the terms and conditions of the GNU general + * public license, version 2 or any later version, incorporated herein by + * reference. * */ @@ -29,5 +29,5 @@ char *strdup(char *str) if ((p = (char *)malloc(strlen(str)+1)) == NULL) return p; - return strcpy(p, str); + return strcpy(p, str); } diff --git a/pppd/plugins/radius/radiusclient/lib/strerror.c b/pppd/plugins/radius/radiusclient/lib/strerror.c index 849f58e..bb51a57 100644 --- a/pppd/plugins/radius/radiusclient/lib/strerror.c +++ b/pppd/plugins/radius/radiusclient/lib/strerror.c @@ -1,11 +1,11 @@ /* - * $Id: strerror.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: strerror.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1996 Lars Fenneberg and Christian Graefe * - * This file is provided under the terms and conditions of the GNU general - * public license, version 2 or any later version, incorporated herein by - * reference. + * This file is provided under the terms and conditions of the GNU general + * public license, version 2 or any later version, incorporated herein by + * reference. * */ diff --git a/pppd/plugins/radius/radiusclient/lib/util.c b/pppd/plugins/radius/radiusclient/lib/util.c index 392db24..813ec7e 100644 --- a/pppd/plugins/radius/radiusclient/lib/util.c +++ b/pppd/plugins/radius/radiusclient/lib/util.c @@ -1,15 +1,15 @@ /* - * $Id: util.c,v 1.1 2002/01/22 16:03:02 dfs Exp $ + * $Id: util.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ * * Copyright (C) 1995,1996,1997 Lars Fenneberg * * Copyright 1992 Livingston Enterprises, Inc. * - * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan + * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan * and Merit Network, Inc. All Rights Reserved * - * See the file COPYRIGHT for the respective terms and conditions. - * If the file is missing contact me at lf@elemental.net + * See the file COPYRIGHT for the respective terms and conditions. + * If the file is missing contact me at lf@elemental.net * and I'll send you a copy. * */ @@ -61,16 +61,16 @@ void rc_str2tm (char *valstr, struct tm *tm) char *rc_getifname(char *tty) { -#if defined(BSD4_4) || defined(linux) - static char name[512]; +#if defined(BSD4_4) || defined(linux) + static char name[512]; int fd; if ((fd = open(tty, O_RDWR|O_NDELAY)) < 0) { rc_log(LOG_ERR, "rc_getifname: can't open %s: %s", tty, strerror(errno)); return NULL; } -#endif - +#endif + #ifdef BSD4_4 strcpy(name,ttyname(fd)); if (strlen(name) < 1) { @@ -88,7 +88,7 @@ char *rc_getifname(char *tty) return NULL; #endif -#if defined(BSD4_4) || defined(linux) +#if defined(BSD4_4) || defined(linux) close(fd); return name; #endif @@ -125,17 +125,17 @@ char *rc_getstr (char *prompt, int do_echo) if ((is_term = isatty(in))) { - + (void) tcgetattr (in, &term_old); term_new = term_old; if (do_echo) term_new.c_lflag |= ECHO; - else + else term_new.c_lflag &= ~ECHO; - + if (tcsetattr (in, TCSAFLUSH, &term_new) == 0) flushed = 1; - + } else { @@ -143,18 +143,18 @@ char *rc_getstr (char *prompt, int do_echo) if ((flags = fcntl(in, F_GETFL, 0)) >= 0) { old_flags = flags; flags |= O_NONBLOCK; - + fcntl(in, F_SETFL, flags); - + while (read(in, &c, 1) > 0) /* nothing */; - + fcntl(in, F_SETFL, old_flags); - + flushed = 1; - } + } } - + write(out, prompt, strlen(prompt)); /* well, this looks ugly, but it handles the following end of line @@ -165,7 +165,7 @@ char *rc_getstr (char *prompt, int do_echo) { if (read(in, &c, 1) <= 0) return NULL; - + if (!flushed && ((c == '\0') || (c == '\r') || (c == '\n'))) { flushed = 1; continue; @@ -185,23 +185,23 @@ char *rc_getstr (char *prompt, int do_echo) } *p = '\0'; - + if (!do_echo || !is_term) write(out, "\r\n", 2); - + if (is_term) tcsetattr (in, TCSAFLUSH, &term_old); else { if ((flags = fcntl(in, F_GETFL, 0)) >= 0) { old_flags = flags; flags |= O_NONBLOCK; - + fcntl(in, F_SETFL, flags); - + while (read(in, &c, 1) > 0) /* nothing */; - + fcntl(in, F_SETFL, old_flags); - } + } } (void) sigprocmask (SIG_SETMASK, &oldset, NULL); @@ -212,7 +212,7 @@ char *rc_getstr (char *prompt, int do_echo) void rc_mdelay(int msecs) { struct timeval tv; - + tv.tv_sec = (int) msecs / 1000; tv.tv_usec = (msecs % 1000) * 1000;