mirror of https://gitee.com/openkylin/cups.git
Make log files readable to group "adm", if present.
Bug-Ubuntu: https://launchpad.net/bugs/345953 Patch-Name: logfiles_adm_readable.patch Gbp-Pq: Name 0025-Make-log-files-readable-to-group-adm-if-present.patch
This commit is contained in:
parent
dca4965086
commit
4e347e8f31
|
@ -21,6 +21,7 @@
|
||||||
# include <systemd/sd-journal.h>
|
# include <systemd/sd-journal.h>
|
||||||
#endif /* HAVE_ASL_H */
|
#endif /* HAVE_ASL_H */
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#include <grp.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -110,6 +111,7 @@ cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
|
||||||
filename[1024], /* Formatted log filename */
|
filename[1024], /* Formatted log filename */
|
||||||
*ptr; /* Pointer into filename */
|
*ptr; /* Pointer into filename */
|
||||||
const char *logptr; /* Pointer into log filename */
|
const char *logptr; /* Pointer into log filename */
|
||||||
|
struct group *loggrp; /* Group entry of log filename */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -129,6 +131,11 @@ cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use adm group if possible, fall back to Group
|
||||||
|
*/
|
||||||
|
loggrp = getgrnam("adm");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Format the filename as needed...
|
* Format the filename as needed...
|
||||||
*/
|
*/
|
||||||
|
@ -241,7 +248,7 @@ cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
|
||||||
* Change ownership and permissions of non-device logs...
|
* Change ownership and permissions of non-device logs...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fchown(cupsFileNumber(*lf), RunUser, Group);
|
fchown(cupsFileNumber(*lf), RunUser, loggrp ? loggrp->gr_gid : Group);
|
||||||
fchmod(cupsFileNumber(*lf), LogFilePerm);
|
fchmod(cupsFileNumber(*lf), LogFilePerm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,7 +291,7 @@ cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
|
||||||
* Change ownership and permissions of non-device logs...
|
* Change ownership and permissions of non-device logs...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fchown(cupsFileNumber(*lf), RunUser, Group);
|
fchown(cupsFileNumber(*lf), RunUser, loggrp ? loggrp->gr_gid : Group);
|
||||||
fchmod(cupsFileNumber(*lf), LogFilePerm);
|
fchmod(cupsFileNumber(*lf), LogFilePerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue