}
}
- 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;
}
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;
}
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) {
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;
}