/*
- * $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.
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
-#ifdef HAVE_FCNTL_H
#include <fcntl.h>
-#endif /* HAVE_FCNTL_H */
#include <pwd.h>
-
-#include <netatalk/endian.h>
+#include <arpa/inet.h>
#include <des.h>
{
u_int8_t key[HEXPASSWDLEN];
Key_schedule schedule;
- int i, j;
+ unsigned int i, j;
if (!newpwd) {
/* convert to binary */
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");