X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fafpd%2Fauth.c;h=fef13eb8fc46ac79dad45003e09013b84fa78e74;hp=0768d22d1d6cacc122b8293798dabe5e79a48ebf;hb=b0bcb8f6b0571592a50ce039882c9319e012a270;hpb=313b5f94348618d65523c1d8bde1fba9988f040a diff --git a/etc/afpd/auth.c b/etc/afpd/auth.c index 0768d22d..fef13eb8 100644 --- a/etc/afpd/auth.c +++ b/etc/afpd/auth.c @@ -38,8 +38,8 @@ extern void afp_get_cmdline( int *ac, char ***av ); #include #include #include +#include -#include "globals.h" #include "auth.h" #include "uam_auth.h" #include "switch.h" @@ -538,7 +538,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); + obj->sinfo.clientid_len = idlen + 8; + } + if (ipc_child_write(obj->ipc_fd, IPC_GETSESSION, idlen+8, p) != 0) + return AFPERR_MISC; tklen = obj->sinfo.sessiontoken_len; token = obj->sinfo.sessiontoken; } @@ -620,7 +626,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) != 0) goto exit; /* write uint16_t DSI request ID */ if (writet(obj->ipc_fd, &dsi->header.dsi_requestID, 2, 0, 2) != 2) {