/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* receive up to n fds from stream fd
* number of fds received is returned
*
* NOTE: cssend() only supported for local host
* for local host Csid_t.hid==0, Csid_t.pid not trusted
* for remote host csauth() can authenticate Csid_t.[ug]id
*/
#include "cslib.h"
#if CS_LIB_SOCKET_RIGHTS && !CS_LIB_STREAM
static int
{
struct
{
} ctl;
#else
#endif
msg.msg_namelen = 0;
#else
#endif
return -1;
return n;
#else
#endif
}
#endif
int
{
int oerrno;
#if CS_LIB_SOCKET
#if CS_LIB_SOCKET_UN && !CS_LIB_STREAM
#endif
#endif
#endif
#if CS_LIB_STREAM || CS_LIB_V10
int m;
#if CS_LIB_V10
#endif
#endif
register int i;
#endif
if (n < 1)
{
return -1;
}
#if CS_LIB_V10
{
{
return -1;
}
return 1;
}
#else
#if CS_LIB_SOCKET
{
#if CS_LIB_SOCKET_UN && !CS_LIB_STREAM
#endif
{
{
return -1;
}
{
goto eperm;
}
{
drop:
return -1;
}
{
messagef((state->id, NiL, -1, "recv: %d: %d: invalid authentication mode %04o", fd, rfd[0], st.st_mode & CS_AUTH_MASK));
goto drop;
}
#else
{
}
#endif
}
else
#endif
return 1;
}
#endif
#endif
#if CS_LIB_STREAM || CS_LIB_V10
{
switch (errno)
{
case EIO:
#ifdef EBADMSG
case EBADMSG:
#endif
break;
default:
return -1;
}
#if CS_LIB_STREAM
#endif
if (m != sizeof(hdr))
{
return -1;
}
{
return -1;
}
{
{
return -1;
}
}
}
#ifdef I_ACCEPT
{
return -1;
}
#endif
else
{
i = 1;
}
return i;
#else
{
nope:
if (i >= 0)
{
}
return -1;
}
{
goto nope;
}
{
messagef((state->id, NiL, -1, "recv: %d: %d: invalid authentication mode %04o", fd, rfd[0], st.st_mode & CS_AUTH_MASK));
goto nope;
}
return n;
#else
{
register int i;
register int j;
char* s;
unsigned long pid;
{
return -1;
}
s[i] = 0;
i = strtol(s, &s, 0);
if (i < n)
n = i;
for (i = 0; i < n; i++)
for (i = j = 0; i < n; i++)
{
if (!stat(s, &st) && (fds[i] = open(s, (st.st_mode & (S_IRUSR|S_IWUSR)) == (S_IRUSR|S_IWUSR) ? O_RDWR : (st.st_mode & S_IWUSR) ? O_WRONLY : O_RDONLY)) >= 0)
j++;
}
if (id)
{
{
}
else
{
}
}
return j;
}
return -1;
#endif
#endif
}
int
{
}