You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Donatas Abraitis <do...@gmail.com> on 2013/11/06 16:16:39 UTC
apache sql module with suexec
Hello,
I'm trying to write a module which would work with httpd.worker. It will
per-request fetch row from mysql returning documentroot, servername, user,
group.
How can I setuid(), setgid()?
I have fetched these user/group from DB using mod_dbd module and now want
to set using suEXEC these user/group.
apr_uid_t _uid;
apr_gid_t _gid;
apr_uid_current(&_uid, &_gid, r->pool);
ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, "apt_user/group:
%d/%d", _uid, _gid);
if(setuid(500)) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, "apt_user:
%d", getuid());
}
Apache log gives:
[Wed Nov 06 10:16:42 2013] [crit] [client X] user: ton
[Wed Nov 06 10:16:42 2013] [crit] [client X] apt_user/group: 48/48
[Wed Nov 06 10:16:42 2013] [crit] [client X] apt_user: 48
[Wed Nov 06 10:16:42 2013] [crit] [client X] group: group-ton
--
Donatas