I was going through the OpenACS install documentation and tweaking the
Unix install docs so they work for Mac OS X and I ran across the
following problem in the "test AOLServer" part of the OpenACS docs:

root# ./bin/nsd -t sample-config.tcl -u nobody -g web
[19/Feb/2004:00:35:41][1858.2684396012][-main-] Fatal: nsmain: invalid
user 'nobody'

On OS X the nobody user has a gid and uid of -2

After asking on the OpenACS irc channel someone pointed to the
following code in aolserver/nsd/nsadmin.c:

-----------------------
    /*
     * Verify the uid/gid args.
     */

    if (uarg != NULL) {
       uid = Ns_GetUid(uarg);
       gid = Ns_GetUserGid(uarg);
       if (uid < 0) {
           uid = atoi(uarg);
       }
       if (uid == 0) {
           Ns_Fatal("nsmain: invalid user '%s'", uarg);
       }
    }
    if (garg != NULL) {
       gid = Ns_GetGid(garg);
       if (gid < 0) {
           gid = atoi(garg);
           if (gid == 0) {
               Ns_Fatal("nsmain: invalid group '%s'", garg);
           }
       }
    }
------------------------

and the following code in unix.c

------------------------

 *----------------------------------------------------------------------
 * Ns_GetUserGid --
 *
 *      Get the group id for a user name
 *
 * Results:
 *      Returns group id of the user name found in /etc/passwd or -1
 *     otherwise.
 *
 * Side effects:
 *      None.
 *
 *----------------------------------------------------------------------
 */

int
Ns_GetUserGid(char *user)
{
    struct passwd  *pw;
    int             retcode;

    Ns_MutexLock(&lock);
    pw = getpwnam(user);
    if (pw == NULL) {
        retcode = -1;
    } else {
        retcode = pw->pw_gid;
    }
    Ns_MutexUnlock(&lock);
    return retcode;
}


/* *---------------------------------------------------------------------- * Ns_GetUid -- * * Get user id for a user name. * * Results: * Return NS_TRUE if user name is found in /etc/passwd file and * NS_FALSE otherwise. * * Side effects: * None. * *---------------------------------------------------------------------- */

int
Ns_GetUid(char *user)
{
    struct passwd  *pw;
    int retcode;

    Ns_MutexLock(&lock);
    pw = getpwnam(user);
    if (pw == NULL) {
        retcode = -1;
    } else {
        retcode = pw->pw_uid;
    }
    Ns_MutexUnlock(&lock);
    return retcode;
}

-------------------------

OpenACS irc diagnosis:

"so that is a bug. it should just return true instead of the uid, which
is what the comment actually says it does. it assumes all UIDs are >0"

Comments? Fixes? Help?

Versions info from the README:

    This is the AOLserver 4.0.0 source distribution.  AOLserver is
    available at http://aolserver.com, a SourceForge hosted site.

RCS: @(#) $Id: README,v 1.4 2003/01/24 18:49:23 elizthom Exp $

Although I think what I downloaded was labeled 4.0.2.

Thanks,
Carl


-- AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to