/*
- * $Id: uams_passwd.c,v 1.26 2009-10-13 22:55:37 didg Exp $
+ * $Id: uams_passwd.c,v 1.31 2010-03-30 12:44:35 franklahm Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
#include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <sys/types.h>
-/* crypt needs _XOPEN_SOURCE (500) at least on BSD, but that breaks Solaris compile */
-#ifdef NETBSD
-#define _XOPEN_SOURCE 500 /* for crypt() */
-#endif
-#ifdef FREEBSD
-#define _XOPEN_SOURCE /* for crypt() */
-#endif
+#include <atalk/standards.h>
+#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
/* STDC check */
#include <sia.h>
#include <siad.h>
-static char *clientname;
+static const char *clientname;
#endif /* TRU64 */
/*XXX in etc/papd/file.h */
struct papfile;
-extern void append(struct papfile *, const char *, int);
+extern UAM_MODULE_EXPORT void append(struct papfile *, const char *, int);
static int pwd_login(void *obj, char *username, int ulen, struct passwd **uam_pwd,
- char *ibuf, int ibuflen,
- char *rbuf _U_, int *rbuflen _U_)
+ char *ibuf, size_t ibuflen,
+ char *rbuf _U_, size_t *rbuflen _U_)
{
char *p;
struct passwd *pwd;
ibuf[ PASSWDLEN ] = '\0';
if (( pwd = uam_getname(obj, username, ulen)) == NULL ) {
- return AFPERR_PARAM;
+ return AFPERR_NOTAUTH;
}
LOG(log_info, logtype_uams, "cleartext login: %s", username);
/* cleartxt login */
static int passwd_login(void *obj, struct passwd **uam_pwd,
- char *ibuf, int ibuflen,
- char *rbuf, int *rbuflen)
+ char *ibuf, size_t ibuflen,
+ char *rbuf, size_t *rbuflen)
{
char *username;
- int len, ulen;
+ size_t len, ulen;
*rbuflen = 0;
(void *) &username, &ulen) < 0)
return AFPERR_MISC;
- if (ibuflen <= 1) {
+ if (ibuflen < 2) {
return( AFPERR_PARAM );
}
len bytes unicode name
*/
static int passwd_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
- char *ibuf, int ibuflen,
- char *rbuf, int *rbuflen)
+ char *ibuf, size_t ibuflen,
+ char *rbuf, size_t *rbuflen)
{
char *username;
- int len, ulen;
+ size_t len, ulen;
u_int16_t temp16;
*rbuflen = 0;
/* change passwd */
static int passwd_changepw(void *obj, char *username,
struct passwd *pwd, char *ibuf,
- int ibuflen, char *rbuf, int *rbuflen)
+ size_t ibuflen, char *rbuf, size_t *rbuflen)
{
#ifdef SHADOWPW
struct spwd *sp;