319 |
/* ------------------------------------------------------------------ Public */ |
/* ------------------------------------------------------------------ Public */ |
320 |
|
|
321 |
/** |
/** |
322 |
* Security check for files. The files must have the same uid as the |
* Security check for files. The files must have the same uid as the |
323 |
* REAL uid of this process, it must have permissions no greater than |
* REAL uid of this process, it must have permissions no greater than |
324 |
* "maxpermission" and it must not be a symbolic link. We check |
* "maxpermission" and it must not be a symbolic link. We check these |
325 |
* these conditions here. (Inspired by code from fetchmail) |
* conditions here. |
326 |
* @param filename The filename of the checked file |
* @param filename The filename of the checked file |
327 |
* @param description The description of the checked file |
* @param description The description of the checked file |
328 |
* @param permmask The permission mask for the file |
* @param permmask The permission mask for the file |
334 |
struct stat buf; |
struct stat buf; |
335 |
errno= 0; |
errno= 0; |
336 |
|
|
337 |
|
ASSERT(filename); |
338 |
|
ASSERT(description); |
339 |
|
|
340 |
if(lstat(filename, &buf) < 0) { |
if(lstat(filename, &buf) < 0) { |
341 |
|
|
342 |
error("%s: Cannot stat the %s '%s' -- %s\n", |
error("%s: Cannot stat the %s '%s' -- %s\n", |