]> arthur.barton.de Git - netatalk.git/blobdiff - bin/afppasswd/afppasswd.c
fix username matching bug in afppasswd. from kanai at nadmin dot org
[netatalk.git] / bin / afppasswd / afppasswd.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");