--- upnphttp.c.orig 2014-08-26 23:09:22.000000000 +0200 +++ upnphttp.c 2015-03-07 19:27:16.000000000 +0100 @@ -1903,10 +1903,38 @@ } } + /* Perform several checks to pin down the file access problem */ + + /*sleep (15); */ + + DPRINTF(E_ERROR, L_HTTP, "Starting debug on file %s ----------------\n", last_file.path); + + DPRINTF(E_ERROR, L_HTTP, "Real UID of the process %i\n", getuid()); + DPRINTF(E_ERROR, L_HTTP, "Real GID of the process %i\n", getgid()); + DPRINTF(E_ERROR, L_HTTP, "Effective UID of the process %i\n", geteuid()); + DPRINTF(E_ERROR, L_HTTP, "Effective GID of the process %i\n", getegid()); + + struct stat file_attr; + int stat_res; + stat_res = stat(last_file.path,&file_attr); + + DPRINTF(E_ERROR, L_HTTP, "Mode of file %hu\n", file_attr.st_mode ); + DPRINTF(E_ERROR, L_HTTP, "UID of file %u\n", file_attr.st_uid ); + DPRINTF(E_ERROR, L_HTTP, "GID of file %u\n", file_attr.st_gid ); + + int access_r,access_w,access_x; + access_r = access( last_file.path, R_OK ); + access_w = access( last_file.path, W_OK ); + access_x = access( last_file.path, X_OK ); + if( access_r == -1 ) {DPRINTF(E_ERROR, L_HTTP, "Error opening for READ %s [%s]\n", last_file.path, strerror( errno ));} + if( access_w == -1 ) {DPRINTF(E_ERROR, L_HTTP, "Error opening for WRITE %s [%s]\n", last_file.path, strerror( errno ));} + if( access_x == -1 ) {DPRINTF(E_ERROR, L_HTTP, "Error opening for EXEC %s [%s]\n", last_file.path, strerror( errno ));} + + offset = h->req_RangeStart; sendfh = open(last_file.path, O_RDONLY); if( sendfh < 0 ) { - DPRINTF(E_ERROR, L_HTTP, "Error opening %s\n", last_file.path); + DPRINTF(E_ERROR, L_HTTP, "Error opening %s [%s]\n", last_file.path, strerror( errno )); Send404(h); goto error; }