]> arthur.barton.de Git - netatalk.git/commitdiff
fix username matching bug in afppasswd. from kanai at nadmin dot org
authorbfernhomberg <bfernhomberg>
Fri, 8 Oct 2004 00:54:40 +0000 (00:54 +0000)
committerbfernhomberg <bfernhomberg>
Fri, 8 Oct 2004 00:54:40 +0000 (00:54 +0000)
bin/afppasswd/afppasswd.c
etc/uams/uams_randnum.c

index 523b433c7da7ee0f480458a8fb56e80a270bd992..b68d2db7794230dd42c2c974e8605059b142059b 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * $Id: afppasswd.c,v 1.11 2003-02-17 02:04:59 srittau Exp $
+ * $Id: afppasswd.c,v 1.11.6.1 2004-10-08 00:54:40 bfernhomberg Exp $
  *
  * Copyright 1999 (c) Adrian Sun (asun@u.washington.edu)
  * All Rights Reserved. See COPYRIGHT.
@@ -139,7 +139,8 @@ static int update_passwd(const char *path, const char *name, int flags)
   while (fgets(buf, sizeof(buf), fp)) {
     if ((p = strchr(buf, ':'))) {
       /* check for a match */
-      if (strncmp(buf, name, p - buf) == 0) {
+      if (strlen(name) == (p - buf) && 
+          strncmp(buf, name, p - buf) == 0) {
        p++;
        if (!(flags & OPT_ISROOT) && (*p == PASSWD_ILLEGAL)) {
          fprintf(stderr, "Your password is disabled. Please see your administrator.\n");
index 4a7a4c5e0df817cc13e96c72dcb832beaee061d0..5cb51265187f358670d39f2ce47aceb258794358 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * $Id: uams_randnum.c,v 1.12.6.3 2004-02-25 00:37:19 bfernhomberg Exp $
+ * $Id: uams_randnum.c,v 1.12.6.4 2004-10-08 00:54:40 bfernhomberg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -172,7 +172,8 @@ static int afppasswd(const struct passwd *pwd,
   memset(buf, 0, sizeof(buf));
   while (fgets(buf, sizeof(buf), fp)) {
     if ((p = strchr(buf, ':'))) {
-      if (strncmp(buf, pwd->pw_name, p - buf) == 0) {
+      if ( strlen(pwd->pw_name) == (p - buf) &&
+           strncmp(buf, pwd->pw_name, p - buf) == 0) {
        p++;
        if (*p == PASSWD_ILLEGAL) {
          LOG(log_info, logtype_uams, "invalid password entry for %s", pwd->pw_name);