httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donatas Abraitis <donatas.abrai...@gmail.com>
Subject apache sql module with suexec
Date Wed, 06 Nov 2013 15:16:39 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message