o __P removal
o register removal o use new style prototypes and function definitions
This commit is contained in:
parent
2b8a08af6b
commit
266ebcd391
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90377
@ -88,7 +88,7 @@ static u_int8_t *BpfPkt = NULL;
|
||||
** If an error is encountered, the program terminates here.
|
||||
*/
|
||||
int
|
||||
BpfOpen()
|
||||
BpfOpen(void)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
char bpfdev[32];
|
||||
@ -217,8 +217,7 @@ BpfOpen()
|
||||
** None.
|
||||
*/
|
||||
char *
|
||||
BpfGetIntfName(errmsg)
|
||||
char **errmsg;
|
||||
BpfGetIntfName(char **errmsg)
|
||||
{
|
||||
struct ifreq ibuf[8], *ifrp, *ifend, *mp;
|
||||
struct ifconf ifc;
|
||||
@ -307,9 +306,7 @@ BpfGetIntfName(errmsg)
|
||||
** None.
|
||||
*/
|
||||
int
|
||||
BpfRead(rconn, doread)
|
||||
RMPCONN *rconn;
|
||||
int doread;
|
||||
BpfRead(RMPCONN *rconn, int doread)
|
||||
{
|
||||
int datlen, caplen, hdrlen;
|
||||
static u_int8_t *bp = NULL, *ep = NULL;
|
||||
@ -373,8 +370,7 @@ BpfRead(rconn, doread)
|
||||
** None.
|
||||
*/
|
||||
int
|
||||
BpfWrite(rconn)
|
||||
RMPCONN *rconn;
|
||||
BpfWrite(RMPCONN *rconn)
|
||||
{
|
||||
if (write(BpfFd, (char *)&rconn->rmp, rconn->rmplen) < 0) {
|
||||
syslog(LOG_ERR, "write: %s: %m", EnetStr(rconn));
|
||||
@ -397,7 +393,7 @@ BpfWrite(rconn)
|
||||
** None.
|
||||
*/
|
||||
void
|
||||
BpfClose()
|
||||
BpfClose(void)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
|
||||
|
@ -151,36 +151,36 @@ extern RMPCONN *RmpConns; /* list of active connections */
|
||||
|
||||
extern u_int8_t RmpMcastAddr[]; /* RMP multicast address */
|
||||
|
||||
void AddConn __P((RMPCONN *));
|
||||
int BootDone __P((RMPCONN *));
|
||||
void BpfClose __P((void));
|
||||
char *BpfGetIntfName __P((char **));
|
||||
int BpfOpen __P((void));
|
||||
int BpfRead __P((RMPCONN *, int));
|
||||
int BpfWrite __P((RMPCONN *));
|
||||
void DebugOff __P((int));
|
||||
void DebugOn __P((int));
|
||||
void DispPkt __P((RMPCONN *, int));
|
||||
void DoTimeout __P((void));
|
||||
void DspFlnm __P((u_int, char *));
|
||||
void Exit __P((int));
|
||||
CLIENT *FindClient __P((RMPCONN *));
|
||||
RMPCONN *FindConn __P((RMPCONN *));
|
||||
void FreeClients __P((void));
|
||||
void FreeConn __P((RMPCONN *));
|
||||
void FreeConns __P((void));
|
||||
int GetBootFiles __P((void));
|
||||
char *GetEtherAddr __P((u_int8_t *));
|
||||
CLIENT *NewClient __P((u_int8_t *));
|
||||
RMPCONN *NewConn __P((RMPCONN *));
|
||||
char *NewStr __P((char *));
|
||||
u_int8_t *ParseAddr __P((char *));
|
||||
int ParseConfig __P((void));
|
||||
void ProcessPacket __P((RMPCONN *, CLIENT *));
|
||||
void ReConfig __P((int));
|
||||
void RemoveConn __P((RMPCONN *));
|
||||
int SendBootRepl __P((struct rmp_packet *, RMPCONN *, char *[]));
|
||||
int SendFileNo __P((struct rmp_packet *, RMPCONN *, char *[]));
|
||||
int SendPacket __P((RMPCONN *));
|
||||
int SendReadRepl __P((RMPCONN *));
|
||||
int SendServerID __P((RMPCONN *));
|
||||
void AddConn(RMPCONN *);
|
||||
int BootDone(RMPCONN *);
|
||||
void BpfClose(void);
|
||||
char *BpfGetIntfName(char **);
|
||||
int BpfOpen(void);
|
||||
int BpfRead(RMPCONN *, int);
|
||||
int BpfWrite(RMPCONN *);
|
||||
void DebugOff(int);
|
||||
void DebugOn(int);
|
||||
void DispPkt(RMPCONN *, int);
|
||||
void DoTimeout(void);
|
||||
void DspFlnm(u_int, char *);
|
||||
void Exit(int);
|
||||
CLIENT *FindClient(RMPCONN *);
|
||||
RMPCONN *FindConn(RMPCONN *);
|
||||
void FreeClients(void);
|
||||
void FreeConn(RMPCONN *);
|
||||
void FreeConns(void);
|
||||
int GetBootFiles(void);
|
||||
char *GetEtherAddr(u_int8_t *);
|
||||
CLIENT *NewClient(u_int8_t *);
|
||||
RMPCONN *NewConn(RMPCONN *);
|
||||
char *NewStr(char *);
|
||||
u_int8_t *ParseAddr(char *);
|
||||
int ParseConfig(void);
|
||||
void ProcessPacket(RMPCONN *, CLIENT *);
|
||||
void ReConfig(int);
|
||||
void RemoveConn(RMPCONN *);
|
||||
int SendBootRepl(struct rmp_packet *, RMPCONN *, char *[]);
|
||||
int SendFileNo(struct rmp_packet *, RMPCONN *, char *[]);
|
||||
int SendPacket(RMPCONN *);
|
||||
int SendReadRepl(RMPCONN *);
|
||||
int SendServerID(RMPCONN *);
|
||||
|
@ -83,7 +83,7 @@ static const char rcsid[] =
|
||||
** to create a linked list of default boot files.
|
||||
*/
|
||||
int
|
||||
ParseConfig()
|
||||
ParseConfig(void)
|
||||
{
|
||||
FILE *fp;
|
||||
CLIENT *client;
|
||||
@ -248,8 +248,7 @@ ParseConfig()
|
||||
** be copied if it's to be saved.
|
||||
*/
|
||||
u_int8_t *
|
||||
ParseAddr(str)
|
||||
char *str;
|
||||
ParseAddr(char *str)
|
||||
{
|
||||
static u_int8_t addr[RMP_ADDRLEN];
|
||||
char *cp;
|
||||
@ -312,7 +311,7 @@ ParseAddr(str)
|
||||
** called to re-order it's list of boot file pointers.
|
||||
*/
|
||||
int
|
||||
GetBootFiles()
|
||||
GetBootFiles(void)
|
||||
{
|
||||
DIR *dfd;
|
||||
struct stat statb;
|
||||
|
@ -72,12 +72,10 @@ static const char rcsid[] =
|
||||
#include <unistd.h>
|
||||
#include "defs.h"
|
||||
|
||||
static void usage __P((void));
|
||||
static void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int c, fd, omask, maxfds;
|
||||
fd_set rset;
|
||||
@ -289,7 +287,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: rbootd [-ad] [-i interface] [config_file]\n");
|
||||
exit (1);
|
||||
@ -308,7 +306,7 @@ usage()
|
||||
** - Timed out connections in `RmpConns' will be freed.
|
||||
*/
|
||||
void
|
||||
DoTimeout()
|
||||
DoTimeout(void)
|
||||
{
|
||||
RMPCONN *rtmp;
|
||||
struct timeval now;
|
||||
@ -345,8 +343,7 @@ DoTimeout()
|
||||
*/
|
||||
|
||||
CLIENT *
|
||||
FindClient(rconn)
|
||||
RMPCONN *rconn;
|
||||
FindClient(RMPCONN *rconn)
|
||||
{
|
||||
CLIENT *ctmp;
|
||||
|
||||
@ -371,8 +368,7 @@ FindClient(rconn)
|
||||
** - This process ceases to exist.
|
||||
*/
|
||||
void
|
||||
Exit(sig)
|
||||
int sig;
|
||||
Exit(int sig)
|
||||
{
|
||||
if (sig > 0)
|
||||
syslog(LOG_ERR, "going down on signal %d", sig);
|
||||
@ -400,8 +396,7 @@ Exit(sig)
|
||||
** - This routine must be called with SIGHUP blocked.
|
||||
*/
|
||||
void
|
||||
ReConfig(signo)
|
||||
int signo;
|
||||
ReConfig(int signo)
|
||||
{
|
||||
syslog(LOG_NOTICE, "reconfiguring boot server");
|
||||
|
||||
@ -427,8 +422,7 @@ ReConfig(signo)
|
||||
** - Debug file is closed.
|
||||
*/
|
||||
void
|
||||
DebugOff(signo)
|
||||
int signo;
|
||||
DebugOff(int signo)
|
||||
{
|
||||
if (DbgFp != NULL)
|
||||
(void) fclose(DbgFp);
|
||||
@ -450,8 +444,7 @@ DebugOff(signo)
|
||||
** otherwise do nothing.
|
||||
*/
|
||||
void
|
||||
DebugOn(signo)
|
||||
int signo;
|
||||
DebugOn(int signo)
|
||||
{
|
||||
if (DbgFp == NULL) {
|
||||
if ((DbgFp = fopen(DbgFile, "w")) == NULL)
|
||||
|
@ -86,9 +86,7 @@ static const char rcsid[] =
|
||||
** sent to the host that sent the packet.
|
||||
*/
|
||||
void
|
||||
ProcessPacket(rconn, client)
|
||||
RMPCONN *rconn;
|
||||
CLIENT *client;
|
||||
ProcessPacket(RMPCONN *rconn, CLIENT *client)
|
||||
{
|
||||
struct rmp_packet *rmp;
|
||||
RMPCONN *rconnout;
|
||||
@ -176,8 +174,7 @@ ProcessPacket(rconn, client)
|
||||
** none.
|
||||
*/
|
||||
int
|
||||
SendServerID(rconn)
|
||||
RMPCONN *rconn;
|
||||
SendServerID(RMPCONN *rconn)
|
||||
{
|
||||
struct rmp_packet *rpl;
|
||||
char *src, *dst;
|
||||
@ -228,10 +225,7 @@ SendServerID(rconn)
|
||||
** none.
|
||||
*/
|
||||
int
|
||||
SendFileNo(req, rconn, filelist)
|
||||
struct rmp_packet *req;
|
||||
RMPCONN *rconn;
|
||||
char *filelist[];
|
||||
SendFileNo(struct rmp_packet *req, RMPCONN *rconn, char *filelist[])
|
||||
{
|
||||
struct rmp_packet *rpl;
|
||||
char *src, *dst;
|
||||
@ -291,10 +285,7 @@ SendFileNo(req, rconn, filelist)
|
||||
** none.
|
||||
*/
|
||||
int
|
||||
SendBootRepl(req, rconn, filelist)
|
||||
struct rmp_packet *req;
|
||||
RMPCONN *rconn;
|
||||
char *filelist[];
|
||||
SendBootRepl(struct rmp_packet *req, RMPCONN *rconn, char *filelist[])
|
||||
{
|
||||
int retval;
|
||||
char *filename, filepath[RMPBOOTDATA+1];
|
||||
@ -400,8 +391,7 @@ SendBootRepl(req, rconn, filelist)
|
||||
** none.
|
||||
*/
|
||||
int
|
||||
SendReadRepl(rconn)
|
||||
RMPCONN *rconn;
|
||||
SendReadRepl(RMPCONN *rconn)
|
||||
{
|
||||
int retval = 0;
|
||||
RMPCONN *oldconn;
|
||||
@ -518,8 +508,7 @@ SendReadRepl(rconn)
|
||||
** none.
|
||||
*/
|
||||
int
|
||||
BootDone(rconn)
|
||||
RMPCONN *rconn;
|
||||
BootDone(RMPCONN *rconn)
|
||||
{
|
||||
RMPCONN *oldconn;
|
||||
struct rmp_packet *rpl;
|
||||
@ -566,8 +555,7 @@ BootDone(rconn)
|
||||
** none.
|
||||
*/
|
||||
int
|
||||
SendPacket(rconn)
|
||||
RMPCONN *rconn;
|
||||
SendPacket(RMPCONN *rconn)
|
||||
{
|
||||
/*
|
||||
* Set Ethernet Destination address to Source (BPF and the enet
|
||||
|
@ -79,9 +79,7 @@ static const char rcsid[] =
|
||||
** None.
|
||||
*/
|
||||
void
|
||||
DispPkt(rconn, direct)
|
||||
RMPCONN *rconn;
|
||||
int direct;
|
||||
DispPkt(RMPCONN *rconn, int direct)
|
||||
{
|
||||
static const char BootFmt[] = "\t\tRetCode:%u SeqNo:%lx SessID:%x Vers:%u";
|
||||
static const char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n";
|
||||
@ -208,8 +206,7 @@ DispPkt(rconn, direct)
|
||||
** be copied if it's to be saved.
|
||||
*/
|
||||
char *
|
||||
GetEtherAddr(addr)
|
||||
u_int8_t *addr;
|
||||
GetEtherAddr(u_int8_t *addr)
|
||||
{
|
||||
static char Hex[] = "0123456789abcdef";
|
||||
static char etherstr[RMP_ADDRLEN*3];
|
||||
@ -249,9 +246,7 @@ GetEtherAddr(addr)
|
||||
** - Characters are sent to `DbgFp'.
|
||||
*/
|
||||
void
|
||||
DspFlnm(size, flnm)
|
||||
u_int size;
|
||||
char *flnm;
|
||||
DspFlnm(u_int size, char *flnm)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -276,8 +271,7 @@ DspFlnm(size, flnm)
|
||||
** - If malloc() fails, a log message will be generated.
|
||||
*/
|
||||
CLIENT *
|
||||
NewClient(addr)
|
||||
u_int8_t *addr;
|
||||
NewClient(u_int8_t *addr)
|
||||
{
|
||||
CLIENT *ctmp;
|
||||
|
||||
@ -309,7 +303,7 @@ NewClient(addr)
|
||||
** - This routine must be called with SIGHUP blocked.
|
||||
*/
|
||||
void
|
||||
FreeClients()
|
||||
FreeClients(void)
|
||||
{
|
||||
CLIENT *ctmp;
|
||||
|
||||
@ -334,8 +328,7 @@ FreeClients()
|
||||
** - If malloc() fails, a log message will be generated.
|
||||
*/
|
||||
char *
|
||||
NewStr(str)
|
||||
char *str;
|
||||
NewStr(char *str)
|
||||
{
|
||||
char *stmp;
|
||||
|
||||
@ -369,8 +362,7 @@ static RMPCONN *LastFree = NULL;
|
||||
** - If malloc() fails, a log message will be generated.
|
||||
*/
|
||||
RMPCONN *
|
||||
NewConn(rconn)
|
||||
RMPCONN *rconn;
|
||||
NewConn(RMPCONN *rconn)
|
||||
{
|
||||
RMPCONN *rtmp;
|
||||
|
||||
@ -410,8 +402,7 @@ NewConn(rconn)
|
||||
** - File desc associated with `rtmp->bootfd' will be closed.
|
||||
*/
|
||||
void
|
||||
FreeConn(rtmp)
|
||||
RMPCONN *rtmp;
|
||||
FreeConn(RMPCONN *rtmp)
|
||||
{
|
||||
/*
|
||||
* If the file descriptor is in use, close the file.
|
||||
@ -445,7 +436,7 @@ FreeConn(rtmp)
|
||||
** - This routine must be called with SIGHUP blocked.
|
||||
*/
|
||||
void
|
||||
FreeConns()
|
||||
FreeConns(void)
|
||||
{
|
||||
RMPCONN *rtmp;
|
||||
|
||||
@ -477,8 +468,7 @@ FreeConns()
|
||||
** - This routine must be called with SIGHUP blocked.
|
||||
*/
|
||||
void
|
||||
AddConn(rconn)
|
||||
RMPCONN *rconn;
|
||||
AddConn(RMPCONN *rconn)
|
||||
{
|
||||
if (RmpConns != NULL)
|
||||
rconn->next = RmpConns;
|
||||
@ -505,8 +495,7 @@ AddConn(rconn)
|
||||
** - This routine must be called with SIGHUP blocked.
|
||||
*/
|
||||
RMPCONN *
|
||||
FindConn(rconn)
|
||||
RMPCONN *rconn;
|
||||
FindConn(RMPCONN *rconn)
|
||||
{
|
||||
RMPCONN *rtmp;
|
||||
|
||||
@ -535,8 +524,7 @@ FindConn(rconn)
|
||||
** - This routine must be called with SIGHUP blocked.
|
||||
*/
|
||||
void
|
||||
RemoveConn(rconn)
|
||||
RMPCONN *rconn;
|
||||
RemoveConn(RMPCONN *rconn)
|
||||
{
|
||||
RMPCONN *thisrconn, *lastrconn;
|
||||
|
||||
|
@ -51,13 +51,11 @@ static const char rcsid[] =
|
||||
* OZ's original sdbm hash
|
||||
*/
|
||||
u_int32_t
|
||||
hash(keyarg, len)
|
||||
const void *keyarg;
|
||||
register size_t len;
|
||||
hash(const void *keyarg, size_t len)
|
||||
{
|
||||
register const u_char *key;
|
||||
register size_t loop;
|
||||
register u_int32_t h;
|
||||
const u_char *key;
|
||||
size_t loop;
|
||||
u_int32_t h;
|
||||
|
||||
#define HASHC h = *key++ + 65599 * h
|
||||
|
||||
@ -102,8 +100,8 @@ hash(keyarg, len)
|
||||
* We mask off all but the lower 8 bits since our table array
|
||||
* can only hold 256 elements.
|
||||
*/
|
||||
u_int32_t hashkey(key)
|
||||
char *key;
|
||||
u_int32_t
|
||||
hashkey(char *key)
|
||||
{
|
||||
|
||||
if (key == NULL)
|
||||
@ -112,9 +110,8 @@ u_int32_t hashkey(key)
|
||||
}
|
||||
|
||||
/* Find an entry in the hash table (may be hanging off a linked list). */
|
||||
char *lookup(table, key)
|
||||
struct group_entry *table[];
|
||||
char *key;
|
||||
char *
|
||||
lookup(struct group_entry *table[], char *key)
|
||||
{
|
||||
struct group_entry *cur;
|
||||
|
||||
@ -146,9 +143,8 @@ char *lookup(table, key)
|
||||
*
|
||||
* That's a lot of comment for such a small piece of code, isn't it.
|
||||
*/
|
||||
void store (table, key, data)
|
||||
struct group_entry *table[];
|
||||
char *key, *data;
|
||||
void
|
||||
store(struct group_entry *table[], char *key, char *data)
|
||||
{
|
||||
struct group_entry *new;
|
||||
u_int32_t i;
|
||||
@ -176,9 +172,8 @@ void store (table, key, data)
|
||||
* an entry in the table, then we just have to do one thing, which is
|
||||
* to update its grouplist.
|
||||
*/
|
||||
void mstore (table, key, data, domain)
|
||||
struct member_entry *table[];
|
||||
char *key, *data, *domain;
|
||||
void
|
||||
mstore(struct member_entry *table[], char *key, char *data, char *domain)
|
||||
{
|
||||
struct member_entry *cur, *new;
|
||||
struct grouplist *tmp;
|
||||
|
@ -59,9 +59,9 @@ struct group_entry {
|
||||
|
||||
#define LINSIZ 1024 * 10
|
||||
|
||||
extern void store __P(( struct group_entry ** , char *, char * ));
|
||||
extern void mstore __P(( struct member_entry ** , char *, char *, char * ));
|
||||
extern char *lookup __P(( struct group_entry **, char * ));
|
||||
extern void __endnetgrent __P(( void ));
|
||||
extern void __setnetgrent __P(( char * ));
|
||||
extern int __getnetgrent __P(( char **, char **, char ** ));
|
||||
extern void store(struct group_entry ** , char *, char *);
|
||||
extern void mstore(struct member_entry ** , char *, char *, char *);
|
||||
extern char *lookup(struct group_entry **, char *);
|
||||
extern void __endnetgrent(void);
|
||||
extern void __setnetgrent(char *);
|
||||
extern int __getnetgrent(char **, char **, char **);
|
||||
|
@ -84,10 +84,8 @@ static struct {
|
||||
(struct netgrp *)0,
|
||||
(char *)0,
|
||||
};
|
||||
static int parse_netgrp();
|
||||
static struct linelist *read_for_group();
|
||||
void __setnetgrent(), __endnetgrent();
|
||||
int __getnetgrent();
|
||||
static int parse_netgrp(char *group);
|
||||
static struct linelist *read_for_group(char *group);
|
||||
extern struct group_entry *gtable[];
|
||||
|
||||
/*
|
||||
@ -97,8 +95,7 @@ extern struct group_entry *gtable[];
|
||||
* most of the work.
|
||||
*/
|
||||
void
|
||||
__setnetgrent(group)
|
||||
char *group;
|
||||
__setnetgrent(char *group)
|
||||
{
|
||||
/* Sanity check */
|
||||
|
||||
@ -123,8 +120,7 @@ __setnetgrent(group)
|
||||
* Get the next netgroup off the list.
|
||||
*/
|
||||
int
|
||||
__getnetgrent(hostp, userp, domp)
|
||||
char **hostp, **userp, **domp;
|
||||
__getnetgrent(char **hostp, char **userp, char **domp)
|
||||
{
|
||||
if (nextgrp) {
|
||||
*hostp = nextgrp->ng_str[NG_HOST];
|
||||
@ -140,10 +136,10 @@ __getnetgrent(hostp, userp, domp)
|
||||
* __endnetgrent() - cleanup
|
||||
*/
|
||||
void
|
||||
__endnetgrent()
|
||||
__endnetgrent(void)
|
||||
{
|
||||
register struct linelist *lp, *olp;
|
||||
register struct netgrp *gp, *ogp;
|
||||
struct linelist *lp, *olp;
|
||||
struct netgrp *gp, *ogp;
|
||||
|
||||
lp = linehead;
|
||||
while (lp) {
|
||||
@ -177,13 +173,12 @@ __endnetgrent()
|
||||
* Parse the netgroup file setting up the linked lists.
|
||||
*/
|
||||
static int
|
||||
parse_netgrp(group)
|
||||
char *group;
|
||||
parse_netgrp(char *group)
|
||||
{
|
||||
register char *spos, *epos;
|
||||
register int len, strpos;
|
||||
char *spos, *epos;
|
||||
int len, strpos;
|
||||
#ifdef DEBUG
|
||||
register int fields;
|
||||
int fields;
|
||||
#endif
|
||||
char *pos, *gpos;
|
||||
struct netgrp *grp;
|
||||
@ -288,11 +283,10 @@ parse_netgrp(group)
|
||||
* is found. Return 1 if eof is encountered.
|
||||
*/
|
||||
static struct linelist *
|
||||
read_for_group(group)
|
||||
char *group;
|
||||
read_for_group(char *group)
|
||||
{
|
||||
register char *pos, *spos, *linep = NULL, *olinep = NULL;
|
||||
register int len, olen;
|
||||
char *pos, *spos, *linep = NULL, *olinep = NULL;
|
||||
int len, olen;
|
||||
int cont;
|
||||
struct linelist *lp;
|
||||
char line[LINSIZ + 1];
|
||||
|
@ -61,16 +61,14 @@ struct group_entry *gtable[TABLESIZE];
|
||||
struct member_entry *mtable[TABLESIZE];
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf (stderr,"usage: revnetgroup -u|-h [-f netgroup file]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
char readbuf[LINSIZ];
|
||||
|
@ -60,6 +60,7 @@ static const char rcsid[] =
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
@ -76,10 +77,9 @@ char remote[MAXHOSTNAMELEN];
|
||||
|
||||
struct sockaddr_in asin = { AF_INET };
|
||||
|
||||
void doit __P((int, struct sockaddr_in *));
|
||||
void getstr __P((char *, int, char *));
|
||||
/*VARARGS1*/
|
||||
void error __P(());
|
||||
void doit(int, struct sockaddr_in *);
|
||||
void getstr(char *, int, char *);
|
||||
void error(const char *fmt, ...);
|
||||
|
||||
int no_uid_0 = 1;
|
||||
|
||||
@ -99,9 +99,7 @@ usage(void)
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
@ -131,9 +129,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
void
|
||||
doit(f, fromp)
|
||||
int f;
|
||||
struct sockaddr_in *fromp;
|
||||
doit(int f, struct sockaddr_in *fromp)
|
||||
{
|
||||
FILE *fp;
|
||||
char cmdbuf[NCARGS+1], *cp;
|
||||
@ -304,24 +300,21 @@ doit(f, fromp)
|
||||
err(1, "%s", pwd->pw_shell);
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
void
|
||||
error(fmt, a1, a2, a3)
|
||||
char *fmt;
|
||||
int a1, a2, a3;
|
||||
error(const char *fmt, ...)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
buf[0] = 1;
|
||||
(void) snprintf(buf+1, sizeof(buf) - 1, fmt, a1, a2, a3);
|
||||
(void)vsnprintf(buf + 1, sizeof(buf) - 1, fmt, ap);
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
getstr(buf, cnt, err)
|
||||
char *buf;
|
||||
int cnt;
|
||||
char *err;
|
||||
getstr(char *buf, int cnt, char *err)
|
||||
{
|
||||
char c;
|
||||
|
||||
|
@ -116,22 +116,20 @@ union sockunion {
|
||||
#define su_family su_si.si_family
|
||||
#define su_port su_si.si_port
|
||||
|
||||
void doit __P((int, union sockunion *));
|
||||
int control __P((int, char *, int));
|
||||
void protocol __P((int, int));
|
||||
void cleanup __P((int));
|
||||
void fatal __P((int, char *, int));
|
||||
int do_rlogin __P((union sockunion *));
|
||||
void getstr __P((char *, int, char *));
|
||||
void setup_term __P((int));
|
||||
int do_krb_login __P((struct sockaddr_in *));
|
||||
void usage __P((void));
|
||||
void doit(int, union sockunion *);
|
||||
int control(int, char *, int);
|
||||
void protocol(int, int);
|
||||
void cleanup(int);
|
||||
void fatal(int, char *, int);
|
||||
int do_rlogin(union sockunion *);
|
||||
void getstr(char *, int, char *);
|
||||
void setup_term(int);
|
||||
int do_krb_login(struct sockaddr_in *);
|
||||
void usage(void);
|
||||
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
extern int __check_rhosts_file;
|
||||
union sockunion from;
|
||||
@ -199,9 +197,7 @@ struct winsize win = { 0, 0, 0, 0 };
|
||||
|
||||
|
||||
void
|
||||
doit(f, fromp)
|
||||
int f;
|
||||
union sockunion *fromp;
|
||||
doit(int f, union sockunion *fromp)
|
||||
{
|
||||
int master, pid, on = 1;
|
||||
int authenticated = 0;
|
||||
@ -336,10 +332,7 @@ char oobdata[] = {TIOCPKT_WINDOW};
|
||||
* window size changes.
|
||||
*/
|
||||
int
|
||||
control(pty, cp, n)
|
||||
int pty;
|
||||
char *cp;
|
||||
int n;
|
||||
control(int pty, char *cp, int n)
|
||||
{
|
||||
struct winsize w;
|
||||
|
||||
@ -359,8 +352,7 @@ control(pty, cp, n)
|
||||
* rlogin "protocol" machine.
|
||||
*/
|
||||
void
|
||||
protocol(f, p)
|
||||
register int f, p;
|
||||
protocol(int f, int p)
|
||||
{
|
||||
char pibuf[1024+1], fibuf[1024], *pbp = NULL, *fbp = NULL;
|
||||
int pcc = 0, fcc = 0;
|
||||
@ -435,7 +427,7 @@ protocol(f, p)
|
||||
if (fcc < 0 && errno == EWOULDBLOCK)
|
||||
fcc = 0;
|
||||
else {
|
||||
register char *cp;
|
||||
char *cp;
|
||||
int left, n;
|
||||
|
||||
if (fcc <= 0)
|
||||
@ -516,8 +508,7 @@ protocol(f, p)
|
||||
}
|
||||
|
||||
void
|
||||
cleanup(signo)
|
||||
int signo;
|
||||
cleanup(int signo)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -536,10 +527,7 @@ cleanup(signo)
|
||||
}
|
||||
|
||||
void
|
||||
fatal(f, msg, syserr)
|
||||
int f;
|
||||
char *msg;
|
||||
int syserr;
|
||||
fatal(int f, char *msg, int syserr)
|
||||
{
|
||||
int len;
|
||||
char buf[BUFSIZ], *bp = buf;
|
||||
@ -562,8 +550,7 @@ fatal(f, msg, syserr)
|
||||
}
|
||||
|
||||
int
|
||||
do_rlogin(dest)
|
||||
union sockunion *dest;
|
||||
do_rlogin(union sockunion *dest)
|
||||
{
|
||||
|
||||
getstr(rusername, sizeof(rusername), "remuser too long");
|
||||
@ -580,10 +567,7 @@ do_rlogin(dest)
|
||||
}
|
||||
|
||||
void
|
||||
getstr(buf, cnt, errmsg)
|
||||
char *buf;
|
||||
int cnt;
|
||||
char *errmsg;
|
||||
getstr(char *buf, int cnt, char *errmsg)
|
||||
{
|
||||
char c;
|
||||
|
||||
@ -599,10 +583,9 @@ getstr(buf, cnt, errmsg)
|
||||
extern char **environ;
|
||||
|
||||
void
|
||||
setup_term(fd)
|
||||
int fd;
|
||||
setup_term(int fd)
|
||||
{
|
||||
register char *cp = index(term+ENVSIZE, '/');
|
||||
char *cp = index(term+ENVSIZE, '/');
|
||||
char *speed;
|
||||
struct termios tt;
|
||||
|
||||
@ -640,7 +623,7 @@ setup_term(fd)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
syslog(LOG_ERR, "usage: rlogind [-" ARGSTR "]");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user