X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fauth.c;h=25ed6049c09f44ac3bc052371a7968ef0c63d7d3;hb=38ccba34fde227ceec6253f8537b42ce012da367;hp=94f7601db62334f34d29738709e7ed0071fe0854;hpb=eb7b72048178c41b0361742d9d3fd3649425a027;p=netatalk.git diff --git a/etc/afpd/auth.c b/etc/afpd/auth.c index 94f7601d..25ed6049 100644 --- a/etc/afpd/auth.c +++ b/etc/afpd/auth.c @@ -473,21 +473,19 @@ int afp_zzz(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen } } - if (dsi->flags & DSI_SLEEPING) { - /* - * According to AFP 3.3 spec we should not return anything, - * but eg 10.5.8 server still returns the numbers of hours - * the server is keeping the sessino (ie max sleeptime). - */ - data = obj->options.sleep / 120; /* hours */ - if (!data) { - data = 1; - } - *rbuflen = sizeof(data); - data = htonl(data); - memcpy(rbuf, &data, sizeof(data)); - rbuf += sizeof(data); + /* + * According to AFP 3.3 spec we should not return anything, + * but eg 10.5.8 server still returns the numbers of hours + * the server is keeping the sessino (ie max sleeptime). + */ + data = obj->options.sleep / 120; /* hours */ + if (!data) { + data = 1; } + *rbuflen = sizeof(data); + data = htonl(data); + memcpy(rbuf, &data, sizeof(data)); + rbuf += sizeof(data); return AFP_OK; } @@ -596,7 +594,13 @@ int afp_getsession( if (ibuflen < idlen || idlen > (90-10)) { return AFPERR_PARAM; } - ipc_child_write(obj->ipc_fd, IPC_GETSESSION, idlen+8, p); + if (!obj->sinfo.clientid) { + obj->sinfo.clientid = malloc(idlen + 8); + memcpy(obj->sinfo.clientid, p, idlen + 8); + } + if (ipc_child_write(&obj->ipc_fd, IPC_GETSESSION, idlen+8, p) == -1) { + + } tklen = obj->sinfo.sessiontoken_len; token = obj->sinfo.sessiontoken; } @@ -678,7 +682,7 @@ int afp_disconnect(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, setitimer(ITIMER_REAL, &none, NULL); /* check for old session, possibly transfering session from here to there */ - if (ipc_child_write(obj->ipc_fd, IPC_DISCOLDSESSION, tklen, &token) == -1) + if (ipc_child_write(&obj->ipc_fd, IPC_DISCOLDSESSION, tklen, &token) == -1) goto exit; /* write uint16_t DSI request ID */ if (writet(obj->ipc_fd, &dsi->header.dsi_requestID, 2, 0, 2) != 2) { @@ -939,8 +943,12 @@ 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) { + DSI *dsi = (DSI *)(obj->handle); + LOG(log_note, logtype_afpd, "AFP logout by %s", obj->username); + of_close_all_forks(); close_all_vol(); + dsi->flags = DSI_AFP_LOGGED_OUT; *rbuflen = 0; return AFP_OK; }