O'Reilly logo

Writing Apache Modules with Perl and C by Lincoln Stein, Doug MacEachern

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.7. User and Group ID Information Routines

These are a handful of routines that act as frontends to the standard Unix getpwnam( ) and getgrnam( ) functions. In addition to their role as easy-to-use wrappers, they provide portability with operating systems that don't provide these calls, such as Win32 systems.

These routines are declared in httpd.h:

uid_t ap_uname2id (const char *uname)

Used internally to process the User configuration directive, this function will use getpwnam() to look up the given user login name and return the user's UID. If the name is prefixed with the # symbol, as in #501, the string is converted into integer format and simply returned. Under Win32 systems, this function always returns 1.

uid_t id = ap_uname2id(uname);

gid_t ap_gname2id (const char *gname)

This function behaves identically to ap_uname2id(), except that it operates on group names and group IDs, using the Unix getgrnam() for its lookups. Under Win32 systems, this function will always return 1.

gid_t id = ap_gname2id(gname);

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required