/*
* Routines to parse an inetd.conf or tlid.conf file. This would be a great
* job for a PERL script.
*
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
*/
#ifndef lint
#endif
#include <stdio.h>
#include <errno.h>
#include <string.h>
extern int errno;
extern void exit();
#include "tcpd.h"
#include "inetcf.h"
/*
* Network configuration files may live in unusual places. Here are some
* guesses. Shorter names follow longer ones.
*/
char *inet_files[] = {
"/private/etc/inetd.conf", /* NEXT */
"/etc/inet/inetd.conf", /* SYSV4 */
"/usr/etc/inetd.conf", /* IRIX?? */
"/etc/inetd.conf", /* BSD */
0,
};
static void inet_chk();
static char *base_name();
/*
* Structure with everything we know about a service.
*/
struct inet_ent {
int type;
};
/* inet_conf - read in and examine inetd.conf (or tlid.conf) entries */
char *conf;
{
char *service;
char *protocol;
char *user;
char *path;
char *arg0;
char *arg1;
char *percent_m();
int i;
/*
* The inetd.conf (or tlid.conf) information is so useful that we insist
* on its availability. When no file is given run a series of educated
* guesses.
*/
if (conf != 0) {
exit(1);
}
} else {
/* void */ ;
if (fp == 0) {
exit(1);
}
conf = inet_files[i];
}
/*
* Process the file. After the 7.0 wrapper release it became clear that
* there are many more inetd.conf formats than the 8 systems that I had
* permits long lines to be broken with backslash-newline.
*/
tcpd_context.line = 0;
continue;
continue;
} else { /* path */
continue;
}
path++;
continue;
/*
* ConvexOS puts RPC version numbers before path names. Jukka
* Ukkonen <ukkonen@csc.fi>.
*/
continue;
}
tcpd_warn("incomplete line");
continue;
}
/*
* We're reading a tlid.conf file, the format is:
*
* ...stuff... path arg_count arguments mod_count modules
*/
tcpd_warn("incomplete line");
continue;
}
}
arg1 = "";
}
return (conf);
}
/* inet_chk - examine one inetd.conf (tlid.conf?) entry */
char *protocol;
char *path;
char *arg0;
char *arg1;
{
/*
* Always warn when the executable does not exist or when it is not
* executable.
*/
}
/*
* Cheat on the miscd tests, nobody uses it anymore.
*/
return;
}
/*
* While we are here...
*/
/*
* The tcpd program gets most of the attention.
*/
/*
* Check: some sites install the wrapper set-uid.
*/
/*
* Check: some sites insert tcpd in inetd.conf, instead of replacing
* the daemon pathname.
*/
/*
* Check: make sure files exist and are executable. On some systems
* the network daemons are set-uid so we cannot complain. Note that
* tcpd takes the basename only in case of absolute pathnames.
*/
}
} else { /* look in REAL_DAEMON_DIR */
tcpd_warn("%s: not found in %s: %m",
}
}
} else {
/*
* No tcpd program found. Perhaps they used the "simple installation"
* recipe. Look for a file with the same basename in REAL_DAEMON_DIR.
* Draw some conservative conclusions when a distinct file is found.
*/
} else {
}
}
/*
*/
}
/* inet_set - remember service status */
char *name;
int type;
{
if (ip == 0) {
exit(1);
}
}
/* inet_get - look up service status */
char *name;
{
if (inet_list == 0)
return (WR_MAYBE);
return (-1);
}
/* base_name - compute last pathname component */
char *path;
{
char *cp;
return (path);
}