summaryrefslogtreecommitdiffstats
path: root/ax25/access.c
diff options
context:
space:
mode:
authorThomas Osterried <thomas@osterried.de>2008-02-16 17:59:33 +0000
committerThomas Osterried <thomas@osterried.de>2008-02-16 17:59:33 +0000
commit3465aec7e1529ed865ff8c30bcacb677fe7ba47c (patch)
treeda21bf40f9dbcb8baa2d108408cde43e2520cbd9 /ax25/access.c
parent4c9b83dd0099100641d7a75855e2db055d7928d8 (diff)
new feature: bcpasswd authentication type "unix".
user has now also the choice to use the standard unix passwd/shadow authentication
Diffstat (limited to 'ax25/access.c')
-rw-r--r--ax25/access.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/ax25/access.c b/ax25/access.c
index 46e010d..c431289 100644
--- a/ax25/access.c
+++ b/ax25/access.c
@@ -121,9 +121,16 @@ void ask_pw_sys(char *prompt, char *pass_want, char *pw)
conv_randomize();
for (i = 0; i < 5; i++) {
+ int k;
+again:
j = conv_random(pwlen, 0);
/* store generated request-numbers */
five_digits[i] = j+1; /* pos0 refers as 1 */
+ /* same number again? */
+ for (k = 0; k < i; k++) {
+ if (five_digits[k] == five_digits[i])
+ goto again;
+ }
/* store expected string in cp->passwd */
pass_want[i] = pw[j];
}
@@ -218,6 +225,9 @@ void write_example_passwd(char *pwfile, char pwlocation, struct passwd *pw) {
fprintf(f, "# %smd5:%s\n", (pwlocation == SYSTEMPW ? "username:" : ""), generate_rand_pw(MINPWLEN_MD5));
fprintf(f, "# sys/baycom standard (not very secure) - length: >= %d and <= %d characters\n", MINPWLEN_SYS, PASSSIZE);
fprintf(f, "# %ssys:%s\n", (pwlocation == SYSTEMPW ? "username:" : ""), generate_rand_pw(MINPWLEN_SYS));
+ fprintf(f, "# unix standard (plaintext): no password is read here. Your password is looked\n");
+ fprintf(f, "# up during login in the system password table /etc/passwd or /etc/shadow\n");
+ fprintf(f, "# unix\n");
fclose(f);
}
@@ -333,9 +343,14 @@ char *read_pwd (struct passwd *pw, int *pwtype)
} else {
p_buf = buf;
}
- if (!(pass = strchr(p_buf, ':')))
- continue;
- *pass++ = 0;
+
+ if (!Strcasecmp(p_buf, "unix")) {
+ pass = p_buf;
+ } else {
+ if (!(pass = strchr(p_buf, ':')))
+ continue;
+ *pass++ = 0;
+ }
while (*pass && isspace(*pass & 0xff))
pass++;
@@ -347,8 +362,13 @@ char *read_pwd (struct passwd *pw, int *pwtype)
*pwtype = PW_MD5;
goto found;
} else if ( (*pwtype & PW_SYS) && (!Strcasecmp(p_buf, "sys") || !strcmp(p_buf, "baycom")) ) {
+ fclose(f);
*pwtype = PW_SYS;
goto found;
+ } else if ( (*pwtype & PW_UNIX) && (!Strcasecmp(p_buf, "unix") ) ) {
+ fclose(f);
+ *pwtype = PW_UNIX;
+ return 0;
}
}
}
@@ -360,7 +380,7 @@ found:
len = strlen(pass);
if ((*pwtype == PW_SYS && len < MINPWLEN_SYS) || (*pwtype == PW_MD5 && len < MINPWLEN_MD5)) {
- sprintf(buf, "Password in in password file too short\r");
+ sprintf(buf, "Password in password file too short\r");
write_ax25(buf, strlen(buf), 1);
goto end;
}