X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libatalk%2Fdsi%2Fdsi_stream.c;h=4b92d2259ed7f5ea13a734909ed4c523ef90473d;hb=b0bcb8f6b0571592a50ce039882c9319e012a270;hp=f6d5f8b6f84c5c1125cff44f521e3ed0ed75ec07;hpb=d2d30d6e470093fc2ffbd3959465b8d99289ed46;p=netatalk.git diff --git a/libatalk/dsi/dsi_stream.c b/libatalk/dsi/dsi_stream.c index f6d5f8b6..4b92d225 100644 --- a/libatalk/dsi/dsi_stream.c +++ b/libatalk/dsi/dsi_stream.c @@ -28,7 +28,6 @@ #include #include -#include #include #define min(a,b) ((a) < (b) ? (a) : (b)) @@ -238,13 +237,15 @@ static void unblock_sig(DSI *dsi) * 1. close the socket * 2. set the DSI_DISCONNECTED flag * - * @return -1 if ppid is 1 which means afpd master died, otherwise 0 + * @returns 0 if successfully entered disconnected state + * -1 if ppid is 1 which means afpd master died + * or euid == 0 ie where still running as root (unauthenticated session) */ int dsi_disconnect(DSI *dsi) { dsi->proto_close(dsi); /* 1 */ dsi->flags |= DSI_DISCONNECTED; /* 2 */ - if (getppid() == 1) + if (geteuid() == 0) return -1; return 0; } @@ -381,12 +382,14 @@ size_t dsi_stream_read(DSI *dsi, void *data, const size_t length) while (stored < length) { len = buf_read(dsi, (u_int8_t *) data + stored, length - stored); if (len == -1 && (errno == EINTR || errno == EAGAIN)) { - LOG(log_debug, logtype_dsi, "dsi_stream_read: select read loop"); + LOG(log_maxdebug, logtype_dsi, "dsi_stream_read: select read loop"); continue; } else if (len > 0) { stored += len; } else { /* eof or error */ /* don't log EOF error if it's just after connect (OSX 10.3 probe) */ + if (errno == ECONNRESET) + dsi->flags |= DSI_GOT_ECONNRESET; if (len || stored || dsi->read_count) { if (! (dsi->flags & DSI_DISCONNECTED)) { LOG(log_error, logtype_dsi, "dsi_stream_read: len:%d, %s",