X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fauth.c;h=0768d22d1d6cacc122b8293798dabe5e79a48ebf;hb=6d60f95c388da5f8f901d67e0018cf4896e6c6dc;hp=9245293c80af9a1841a7556cb0026143d341dafb;hpb=cdb7047fb6897c1ad8b4ac264001d44154bf144d;p=netatalk.git diff --git a/etc/afpd/auth.c b/etc/afpd/auth.c index 9245293c..0768d22d 100644 --- a/etc/afpd/auth.c +++ b/etc/afpd/auth.c @@ -380,12 +380,14 @@ static int login(AFPObj *obj, struct passwd *pwd, void (*logout)(void), int expi } /* ---------------------- */ -int afp_zzz(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) +int afp_zzz(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) { uint32_t data; DSI *dsi = (DSI *)AFPobj->handle; *rbuflen = 0; + ibuf += 2; + ibuflen -= 2; if (ibuflen < 4) return AFPERR_MISC; @@ -401,19 +403,20 @@ int afp_zzz(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbu if (data & AFPZZZ_EXT_WAKEUP) { /* wakeup request from exetended sleep */ if (dsi->flags & DSI_EXTSLEEP) { - LOG(log_debug, logtype_afpd, "afp_zzz: waking up from extended sleep"); + LOG(log_note, logtype_afpd, "afp_zzz: waking up from extended sleep"); dsi->flags &= ~(DSI_SLEEPING | DSI_EXTSLEEP); } } else { /* sleep request */ dsi->flags |= DSI_SLEEPING; if (data & AFPZZZ_EXT_SLEEP) { - LOG(log_debug, logtype_afpd, "afp_zzz: entering extended sleep"); + LOG(log_note, logtype_afpd, "afp_zzz: entering extended sleep"); dsi->flags |= DSI_EXTSLEEP; } else { - LOG(log_debug, logtype_afpd, "afp_zzz: entering normal sleep"); + LOG(log_note, logtype_afpd, "afp_zzz: entering normal sleep"); } } + /* * According to AFP 3.3 spec we should not return anything, * but eg 10.5.8 server still returns the numbers of hours @@ -876,11 +879,15 @@ int afp_logincont(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *r } -int afp_logout(AFPObj *obj, char *ibuf _U_, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen _U_) +int afp_logout(AFPObj *obj, char *ibuf _U_, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen) { + DSI *dsi = (DSI *)(obj->handle); + LOG(log_note, logtype_afpd, "AFP logout by %s", obj->username); + of_close_all_forks(); close_all_vol(); - obj->exit(0); + dsi->flags = DSI_AFP_LOGGED_OUT; + *rbuflen = 0; return AFP_OK; }