X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fauth.c;h=566a8d0e05b1b838ddc5e2dceef29463e9c33d03;hb=5116ed2346ea7ee6e5a9858dee94f3eacdc00d7e;hp=f6082fad16f0f51270bea2b54ff119d72bc7db49;hpb=b3a45592aba87abcc9c6e019746e027399f5850b;p=netatalk.git diff --git a/etc/afpd/auth.c b/etc/afpd/auth.c index f6082fad..566a8d0e 100644 --- a/etc/afpd/auth.c +++ b/etc/afpd/auth.c @@ -436,12 +436,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; @@ -456,14 +458,21 @@ 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) + if (dsi->flags & DSI_EXTSLEEP) { + 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) + if (data & AFPZZZ_EXT_SLEEP) { + LOG(log_note, logtype_afpd, "afp_zzz: entering extended sleep"); dsi->flags |= DSI_EXTSLEEP; + } else { + 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 @@ -926,11 +935,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; }