From 6e1de6469d0595740fd8350f435b0562d23d87fa Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 1 Nov 2006 13:14:05 +0100 Subject: [PATCH] Remove underscores from _get_user(), struct _user and _user_list As the variants without underscore were removed in the previous patch. The exception is user_list which contains the name of the config file containing all users and which is still needed. So rename it to user_list_file. --- command.c | 4 ++-- server.c | 36 ++++++++++++++++++------------------ server.h | 4 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/command.c b/command.c index c4229d4f..0be61e80 100644 --- a/command.c +++ b/command.c @@ -1022,7 +1022,7 @@ int handle_connect(int fd, struct sockaddr_in *addr) int numbytes, ret, argc, use_rc4 = 0; char buf[STRINGSIZE]; unsigned char crypt_buf[MAXLINE]; - struct _user u; + struct user u; struct server_command *cmd = NULL; long unsigned challenge_nr, chall_response; char **argv = NULL; @@ -1062,7 +1062,7 @@ int handle_connect(int fd, struct sockaddr_in *addr) } PARA_DEBUG_LOG("received %s request for user %s\n", use_rc4? "rc4" : "auth", u.name); - if ((ret = _get_user(&u)) < 0) + if ((ret = get_user(&u)) < 0) goto err_out; if (!ret) { /* user not found */ PARA_WARNING_LOG("auth request for unknown user %s\n", u.name); diff --git a/server.c b/server.c index b7334fc5..20efdce4 100644 --- a/server.c +++ b/server.c @@ -58,8 +58,8 @@ struct misc_meta_data *mmd; * senders. */ struct server_args_info conf; -char *user_list = NULL; -struct list_head _user_list; +char *user_list_file = NULL; +struct list_head user_list; extern void dccp_send_init(struct sender *); extern void http_send_init(struct sender *); extern void ortp_send_init(struct sender *); @@ -223,11 +223,11 @@ static void parse_config(int override) cf = conf.config_file_arg; else cf = make_message("%s/.paraslash/server.conf", home); - free(user_list); + free(user_list_file); if (!conf.user_list_given) - user_list = make_message("%s/.paraslash/server.users", home); + user_list_file = make_message("%s/.paraslash/server.users", home); else - user_list = para_strdup(conf.user_list_arg); + user_list_file = para_strdup(conf.user_list_arg); ret = stat(cf, &statbuf); if (ret && conf.config_file_given) { ret = -1; @@ -253,8 +253,8 @@ out: free(home); if (ret > 0) return; - free(user_list); - user_list = NULL; + free(user_list_file); + user_list_file = NULL; exit(EXIT_FAILURE); } @@ -277,7 +277,7 @@ static void setup_signal_handling(void) } /* - * lookup user in user_list file. Fills in a user struct containing + * lookup user in user list file. Fills in a user struct containing * filename of the user's public key as well as the permissions of that user. * Returns 1 on success, 0 if user does not exist and < 0 on errors. */ @@ -289,12 +289,12 @@ static void populate_user_list(void) { char w[MAXLINE], n[MAXLINE], k[MAXLINE], p[MAXLINE], tmp[4][MAXLINE]; int num, ret; - file_ptr = fopen(user_list, "r"); + file_ptr = fopen(user_list_file, "r"); ret = -E_USERLIST; if (!file_ptr) goto out; for (;;) { - struct _user *u; + struct user *u; ret = para_fgets(line, MAXLINE, file_ptr); if (ret < 0) PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret)); @@ -305,7 +305,7 @@ static void populate_user_list(void) { if (strcmp(w, "user")) continue; PARA_DEBUG_LOG("found entry for %s\n", n); - u = para_malloc(sizeof(struct _user)); + u = para_malloc(sizeof(struct user)); u->name = para_strdup(n); u->rsa = para_malloc(sizeof(RSA)); ret = get_rsa_key(k, &u->rsa, 0 /* public */); @@ -331,7 +331,7 @@ static void populate_user_list(void) { PARA_WARNING_LOG("unknown permission: %s\n", tmp[num]); } - para_list_add(&u->node, &_user_list); + para_list_add(&u->node, &user_list); } out: if (file_ptr) @@ -344,18 +344,18 @@ out: static void init_user_list(void) { - struct _user *u, *tmp; + struct user *u, *tmp; static int initialized; if (initialized) { - list_for_each_entry_safe(u, tmp, &_user_list, node) { + list_for_each_entry_safe(u, tmp, &user_list, node) { list_del(&u->node); free(u->name); free(u->rsa); free(u); } } else - INIT_LIST_HEAD(&_user_list); + INIT_LIST_HEAD(&user_list); initialized = 1; populate_user_list(); } @@ -368,10 +368,10 @@ static void init_user_list(void) * * \return 1 on success and < 0 on errors. */ -int _get_user(struct _user *user) +int get_user(struct user *user) { - struct _user *u; - list_for_each_entry(u, &_user_list, node) { + struct user *u; + list_for_each_entry(u, &user_list, node) { if (strcmp(u->name, user->name)) continue; *user = *u; diff --git a/server.h b/server.h index 1652d91e..bf835374 100644 --- a/server.h +++ b/server.h @@ -38,7 +38,7 @@ enum {DB_READ = 1, DB_WRITE = 2, AFS_READ = 4, AFS_WRITE = 8}; /** * data needed to authenticate the user */ -struct _user { +struct user { /** the position of this user in the list of users */ struct list_head node; /** the username */ @@ -155,6 +155,6 @@ struct misc_meta_data{ extern struct server_args_info conf; int handle_connect(int fd, struct sockaddr_in *addr); -int _get_user(struct _user *user); +int get_user(struct user *user); void mmd_unlock(void); void mmd_lock(void); -- 2.39.2