/*
*
* This program hangs on the second pass through 'shepherdprocess'.
* the forked child stops at
(gdb) where
#0 0x3bc00 in select ()
#1 0x2b4e0 in IOMGR ()
#2 0x2aa20 in Create_Process_Part2 ()
#3 0x2b228 in savecontext ()
#4 0x2b980 in IOMGR_Initialize ()
#5 0x12 in _DYNAMIC ()
*
* software: AFS 3.3a
* platform: sun4m_412
*
* Are there other ways to do this without pulling in the LWP package?
*
* Or better yet has anyone made "Generic NQS" AFS aware?
*
* Jeff Bartlett
* Avant! Corporation
* [EMAIL PROTECTED]
*
* ---------------------------------
% setenv JB_PASSWD '"one"'
% setenv NQS_PASSWD '"two"'
% gcc -g -o /tmp/bug -I/usr/afsws/include \
"-DJB_PASSWD=$JB_PASSWD" "-DNQS_PASSWD=$NQS_PASSWD" \
../src/bug.c \
-static -L/usr/afsws/lib \
-L/usr/afsws/lib/afs -lsys -lkauth -lprot -lauth -lauth -lubik -ldes \
-lcom_err /usr/afsws/lib/afs/util.a -lrxkad -lrx -llwp -laudit
% /tmp/bug
*
*
*/
#include <stdio.h>
#include <errno.h>
#include <afs/stds.h>
#include <afs/kautils.h>
shepherdprocess ()
{
long pw_expires = -1;
char *afs_fail_reason;
sleep(1);
printf("shepherd\n");
setpag();
if (ka_UserAuthenticateGeneral(
KA_USERAUTH_VERSION+KA_USERAUTH_DOSETPAG,
"jb",
(char *) 0, /* instance */
(char *) 0, /* cell */
JB_PASSWD,
0, /* lifetime (default) */
&pw_expires,
0,
&afs_fail_reason) != 0)
{
printf ("E$Can not authenticate to 'jb': %s\n", afs_fail_reason);
fflush (stdout);
}
system("/usr/afsws/bin/tokens");
sleep(1);
exit(0);
}
pass()
{
int shepherd_pid;
int serverstatus;
printf("pass\n");
if ((shepherd_pid = fork()) == 0)
{
shepherdprocess ();
}
else if ( shepherd_pid == -1)
{
printf("fork failed\n");
}
else
{
printf("good fork\n");
}
while (wait (&serverstatus) == -1 && errno == EINTR)
;
}
int
main()
{
long pw_expires = -1;
char *afs_fail_reason;
setpag();
if (ka_UserAuthenticateGeneral(
KA_USERAUTH_VERSION+KA_USERAUTH_DOSETPAG,
"nqs",
(char *) 0, /* instance */
(char *) 0, /* cell */
NQS_PASSWD,
0, /* lifetime (default) */
&pw_expires,
0,
&afs_fail_reason) != 0)
{
printf ("E$Can not authenticate to 'nqs': %s\n", afs_fail_reason);
fflush (stdout);
}
system("/usr/afsws/bin/tokens");
pass();
sleep(10);
pass();
}