X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=bin%2Fafppasswd%2Fafppasswd.c;h=2d788baa7ee34a1dff54fe1091d244c0d5343d3a;hb=be96d276348da0a7e66eeec844b306e8a5fa8fac;hp=523b433c7da7ee0f480458a8fb56e80a270bd992;hpb=055608347fa93b09140c062ce8f971f7baa67a95;p=netatalk.git diff --git a/bin/afppasswd/afppasswd.c b/bin/afppasswd/afppasswd.c index 523b433c..2d788baa 100644 --- a/bin/afppasswd/afppasswd.c +++ b/bin/afppasswd/afppasswd.c @@ -1,5 +1,5 @@ /* - * $Id: afppasswd.c,v 1.11 2003-02-17 02:04:59 srittau Exp $ + * $Id: afppasswd.c,v 1.19 2005-04-28 20:49:19 bfernhomberg Exp $ * * Copyright 1999 (c) Adrian Sun (asun@u.washington.edu) * All Rights Reserved. See COPYRIGHT. @@ -28,19 +28,14 @@ #include #include #include -#ifdef HAVE_UNISTD_H #include -#endif /* HAVE_UNISTD_H */ #include #include #include #include -#ifdef HAVE_FCNTL_H #include -#endif /* HAVE_FCNTL_H */ #include - -#include +#include #include @@ -73,7 +68,7 @@ static void convert_passwd(char *buf, char *newpwd, const int keyfd) { u_int8_t key[HEXPASSWDLEN]; Key_schedule schedule; - int i, j; + unsigned int i, j; if (!newpwd) { /* convert to binary */ @@ -139,7 +134,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");