/*
- * $Id: uams_randnum.c,v 1.19 2009-10-15 11:39:48 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
#include <stdio.h>
#include <stdlib.h>
-
-/* STDC check */
-#if STDC_HEADERS
#include <string.h>
-#else /* STDC_HEADERS */
-#ifndef HAVE_STRCHR
-#define strchr index
-#define strrchr index
-#endif /* HAVE_STRCHR */
-char *strchr (), *strrchr ();
-#ifndef HAVE_MEMCPY
-#define memcpy(d,s,n) bcopy ((s), (d), (n))
-#define memmove(d,s,n) bcopy ((s), (d), (n))
-#endif /* ! HAVE_MEMCPY */
-#endif /* STDC_HEADERS */
-
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-#ifdef HAVE_FCNTL_H
#include <fcntl.h>
-#endif /* HAVE_FCNTL_H */
#include <ctype.h>
#include <pwd.h>
#include <sys/stat.h>
#include <sys/param.h>
+#include <arpa/inet.h>
#include <atalk/logger.h>
-
-#include <netatalk/endian.h>
-
#include <atalk/afp.h>
#include <atalk/uam.h>
static C_Block seskey;
static Key_schedule seskeysched;
static struct passwd *randpwd;
-static u_int8_t randbuf[8];
+static uint8_t randbuf[8];
/* hash to a 16-bit number. this will generate completely harmless
* warnings on 64-bit machines. */
unsigned char *passwd, int len,
const int set)
{
- u_int8_t key[DES_KEY_SZ*2];
+ uint8_t key[DES_KEY_SZ*2];
char buf[MAXPATHLEN + 1], *p;
Key_schedule schedule;
FILE *fp;
{
char *passwdfile;
- u_int16_t sessid;
+ uint16_t sessid;
size_t len;
int err;
if (( randpwd = uam_getname(obj, username, ulen)) == NULL )
- return AFPERR_PARAM; /* unknown user */
+ return AFPERR_NOTAUTH; /* unknown user */
LOG(log_info, logtype_uams, "randnum/rand2num login: %s", username);
if (uam_checkuser(randpwd) < 0)
char *ibuf, size_t ibuflen _U_,
char *rbuf _U_, size_t *rbuflen)
{
- u_int16_t sessid;
+ uint16_t sessid;
*rbuflen = 0;
char *ibuf, size_t ibuflen _U_,
char *rbuf, size_t *rbuflen)
{
- u_int16_t sessid;
+ uint16_t sessid;
unsigned int i;
*rbuflen = 0;
#endif /* USE_CRACKLIB */
if (!err)
- err = randpass(pwd, passwdfile, ibuf + PASSWDLEN, sizeof(seskey), 1);
+ err = randpass(pwd, passwdfile, (unsigned char *)ibuf + PASSWDLEN, sizeof(seskey), 1);
/* zero out some fields */
memset(&seskeysched, 0, sizeof(seskeysched));
{
char *username;
size_t len, ulen;
- u_int16_t temp16;
+ uint16_t temp16;
*rbuflen = 0;