176 |
177 |
177 // evalutate all ACLs |
178 // evalutate all ACLs |
178 ACLList *acl = acl_evallist(list, user, access_mask, NULL); |
179 ACLList *acl = acl_evallist(list, user, access_mask, NULL); |
179 if(acl) { |
180 if(acl) { |
180 acl_set_error_status(sn, rq, acl, user); |
181 acl_set_error_status(sn, rq, acl, user); |
181 // TODO: don't free the user here |
182 // TODO: don't free the user here #51 |
182 if(user) { |
183 if(user) { |
183 user->free(user); |
184 user->free(user); |
184 } |
185 } |
185 return REQ_ABORTED; |
186 return REQ_ABORTED; |
186 } |
187 } |
314 uid_t uid, |
315 uid_t uid, |
315 gid_t gid, |
316 gid_t gid, |
316 uid_t owner, |
317 uid_t owner, |
317 gid_t owninggroup); |
318 gid_t owninggroup); |
318 |
319 |
319 int fs_acl_check(SysACL *acl, User *user, char *path, uint32_t access_mask) { |
320 int fs_acl_check(SysACL *acl, User *user, const char *path, uint32_t access_mask) { |
320 sstr_t p; |
321 sstr_t p; |
321 if(path[0] != '/') { |
322 if(path[0] != '/') { |
322 size_t n = 128; |
323 size_t n = 128; |
323 char *cwd = malloc(n); |
324 char *cwd = malloc(n); |
324 while(!getcwd(cwd, n)) { |
325 while(!getcwd(cwd, n)) { |
329 free(cwd); |
330 free(cwd); |
330 return 0; |
331 return 0; |
331 } |
332 } |
332 } |
333 } |
333 sstr_t wd = sstr(cwd); |
334 sstr_t wd = sstr(cwd); |
334 sstr_t pp = sstr(path); |
335 sstr_t pp = sstr((char*)path); |
335 |
336 |
336 p = sstrcat(3, wd, sstrn("/", 1), pp); |
337 p = sstrcat(3, wd, sstrn("/", 1), pp); |
337 } else { |
338 } else { |
338 p = sstrdup(sstr(path)); |
339 p = sstrdup(sstr((char*)path)); |
339 } |
340 } |
340 if(p.ptr[p.length-1] == '/') { |
341 if(p.ptr[p.length-1] == '/') { |
341 p.ptr[p.length-1] = 0; |
342 p.ptr[p.length-1] = 0; |
342 p.length--; |
343 p.length--; |
343 } |
344 } |
569 |
575 |
570 int fs_acl_check(SysACL *acl, User *user, char *path, uint32_t access_mask) { |
576 int fs_acl_check(SysACL *acl, User *user, char *path, uint32_t access_mask) { |
571 return 1; |
577 return 1; |
572 } |
578 } |
573 |
579 |
|
580 int fs_acl_check_fd(SysACL *acl, User *user, int fd, uint32_t access_mask) { |
|
581 return 1; |
|
582 } |
|
583 |
574 void fs_acl_finish() { |
584 void fs_acl_finish() { |
575 |
585 |
576 } |
586 } |
577 |
587 |
578 #endif |
588 #endif |
579 |
589 |
580 #ifdef BSD |
590 #ifdef BSD |
581 |
591 |
582 int fs_acl_check(SysACL *acl, User *user, char *path, uint32_t access_mask) { |
592 int fs_acl_check(SysACL *acl, User *user, const char *path, uint32_t access_mask) { |
|
593 return 1; |
|
594 } |
|
595 |
|
596 int fs_acl_check_fd(SysACL *acl, User *user, int fd, uint32_t access_mask) { |
583 return 1; |
597 return 1; |
584 } |
598 } |
585 |
599 |
586 void fs_acl_finish() { |
600 void fs_acl_finish() { |
587 |
601 |
592 |
606 |
593 #ifdef LINUX |
607 #ifdef LINUX |
594 |
608 |
595 #include <sys/fsuid.h> |
609 #include <sys/fsuid.h> |
596 |
610 |
597 int fs_acl_check(SysACL *acl, User *user, char *path, uint32_t access_mask) { |
611 int fs_acl_check(SysACL *acl, User *user, const char *path, uint32_t access_mask) { |
598 struct passwd *ws_pw = conf_getglobals()->Vuserpw; |
612 struct passwd *ws_pw = conf_getglobals()->Vuserpw; |
599 if(!ws_pw) { |
613 if(!ws_pw) { |
600 log_ereport(LOG_FAILURE, "fs_acl_check: unknown webserver uid/gid"); |
614 log_ereport(LOG_FAILURE, "fs_acl_check: unknown webserver uid/gid"); |
601 return 1; |
615 return 1; |
602 } |
616 } |