summaryrefslogtreecommitdiff
path: root/authenticate.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-05-13 12:21:10 +0000
committerAndrew Tridgell <tridge@samba.org>1998-05-13 12:21:10 +0000
commitc8e78d87ad420c06f6b1688ef8d2e86a01c6bc76 (patch)
tree07f962507edca49982796b043c1054eb615271d5 /authenticate.c
parentbcb7e50250111ebfd299355783201223097212bd (diff)
downloadrsync-c8e78d87ad420c06f6b1688ef8d2e86a01c6bc76.tar.gz
improved the authentication and in particular the error reporting
Diffstat (limited to 'authenticate.c')
-rw-r--r--authenticate.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/authenticate.c b/authenticate.c
index 4f4aac22..c3a3c184 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -142,6 +142,7 @@ int auth_server(int fd, int module, char *addr, char *leader)
char secret[100];
char pass[30];
char pass2[30];
+ char *tok;
/* if no auth list then allow anyone in! */
if (!users || !*users) return 1;
@@ -163,6 +164,18 @@ int auth_server(int fd, int module, char *addr, char *leader)
return 0;
}
+ users = strdup(users);
+ if (!users) return 0;
+
+ for (tok=strtok(users," ,\t"); tok; tok = strtok(NULL," ,\t")) {
+ if (strcmp(tok, user) == 0) break;
+ }
+ free(users);
+
+ if (!tok) {
+ return 0;
+ }
+
memset(secret, 0, sizeof(secret));
if (!get_secret(module, user, secret, sizeof(secret)-1)) {
memset(secret, 0, sizeof(secret));