From: Andre Noll Date: Sat, 12 Aug 2017 23:02:17 +0000 (+0200) Subject: server: Constify return value of lookup_user(). X-Git-Tag: v0.6.2~4^2~17 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=1a4ab483a2a41160e548e799609f964a7a6f3400 server: Constify return value of lookup_user(). Command handlers only need to read this structure. --- diff --git a/command.c b/command.c index a72a524f..74e13635 100644 --- a/command.c +++ b/command.c @@ -784,7 +784,7 @@ struct connection_features { int dummy; /* none at the moment */ }; -static int parse_auth_request(char *buf, int len, struct user **u, +static int parse_auth_request(char *buf, int len, const struct user **u, struct connection_features *cf) { int ret; diff --git a/command.h b/command.h index 0265f056..a7fa4673 100644 --- a/command.h +++ b/command.h @@ -3,7 +3,7 @@ /** Per connection data available to command handlers. */ struct command_context { /** The paraslash user that executes this command. */ - struct user *u; + const struct user *u; /** File descriptor and crypto keys. */ struct stream_cipher_context scc; }; diff --git a/user_list.c b/user_list.c index e4866029..cf53c0fa 100644 --- a/user_list.c +++ b/user_list.c @@ -127,9 +127,9 @@ void init_user_list(char *user_list_file) * \return A pointer to the corresponding user struct if the user was found, \p * NULL otherwise. */ -struct user *lookup_user(const char *name) +const struct user *lookup_user(const char *name) { - struct user *u; + const struct user *u; list_for_each_entry(u, &user_list, node) { if (strcmp(u->name, name)) continue; diff --git a/user_list.h b/user_list.h index 41fad164..e4fbd466 100644 --- a/user_list.h +++ b/user_list.h @@ -33,4 +33,4 @@ struct user { }; void init_user_list(char *user_list_file); -struct user *lookup_user(const char *name); +const struct user *lookup_user(const char *name);