X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fuam.c;h=8adfb3bbd9539a9e3daa1b9b9e6f4a871862a269;hb=df7560dfdb12b06090dc4b2c6e88d0858930b591;hp=7a1c034e317ab6119042f405650ab9678f2d36bf;hpb=b0f27d04cd6fe2501ba8aad67a929a4f2bb29baf;p=netatalk.git diff --git a/etc/afpd/uam.c b/etc/afpd/uam.c index 7a1c034e..8adfb3bb 100644 --- a/etc/afpd/uam.c +++ b/etc/afpd/uam.c @@ -11,28 +11,9 @@ #include #include - -/* STDC check */ -#if STDC_HEADERS #include -#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 -#endif /* HAVE_UNISTD_H */ -#ifdef HAVE_FCNTL_H #include -#endif /* HAVE_FCNTL_H */ #include #include #include @@ -45,8 +26,6 @@ char *strchr (), *strrchr (); #include #include -#include -#include #include #include #include @@ -317,7 +296,7 @@ int uam_checkuser(const struct passwd *pwd) int uam_random_string (AFPObj *obj, char *buf, int len) { - u_int32_t result; + uint32_t result; int ret; int fd; @@ -332,7 +311,7 @@ int uam_random_string (AFPObj *obj, char *buf, int len) if (gettimeofday(&tv, &tz) < 0) return -1; - srandom(tv.tv_sec + (unsigned long) obj + (unsigned long) obj->handle); + srandom(tv.tv_sec + (unsigned long) obj + (unsigned long) obj->dsi); for (i = 0; i < len; i += sizeof(result)) { result = random(); memcpy(buf + i, &result, sizeof(result)); @@ -359,7 +338,7 @@ int uam_afpserver_option(void *private, const int what, void *option, switch (what) { case UAM_OPTION_USERNAME: - *buf = obj->username; + *buf = &(obj->username[0]); if (len) *len = sizeof(obj->username) - 1; break; @@ -385,11 +364,6 @@ int uam_afpserver_option(void *private, const int what, void *option, *len = sizeof(obj->options.passwdminlen); break; - case UAM_PASSWD_MAXFAIL: - *((int *) option) = obj->options.loginmaxfail; - *len = sizeof(obj->options.loginmaxfail); - break; - case UAM_PASSWD_EXPIRETIME: /* not implemented */ default: return -1; @@ -422,7 +396,7 @@ int uam_afpserver_option(void *private, const int what, void *option, case UAM_OPTION_CLIENTNAME: { - struct DSI *dsi = obj->handle; + struct DSI *dsi = obj->dsi; const struct sockaddr *sa; static char hbuf[NI_MAXHOST]; @@ -487,31 +461,18 @@ int uam_afp_read(void *handle, char *buf, size_t *buflen, if (!obj) return AFPERR_PARAM; - switch (obj->proto) { -#ifndef NO_DDP - case AFPPROTO_ASP: - if ((len = asp_wrtcont(obj->handle, buf, buflen )) < 0) - goto uam_afp_read_err; - return action(handle, buf, *buflen); - break; -#endif - case AFPPROTO_DSI: - len = dsi_writeinit(obj->handle, buf, *buflen); + len = dsi_writeinit(obj->dsi, buf, *buflen); if (!len || ((len = action(handle, buf, len)) < 0)) { - dsi_writeflush(obj->handle); + dsi_writeflush(obj->dsi); goto uam_afp_read_err; } - while ((len = (dsi_write(obj->handle, buf, *buflen)))) { + while ((len = (dsi_write(obj->dsi, buf, *buflen)))) { if ((len = action(handle, buf, len)) < 0) { - dsi_writeflush(obj->handle); + dsi_writeflush(obj->dsi); goto uam_afp_read_err; } } - break; - default: - return -1; - } return 0; uam_afp_read_err: