|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 2578 (0xa12)
Types: TextFile
Names: »dtia_server.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦038380b96⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦038380b96⟧
└─⟦this⟧ »dtia_server.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦0732ea0cf⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦0732ea0cf⟧
└─⟦this⟧ »../../dtia/release_apollo_2.1/dtia_server.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦25fab149a⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦25fab149a⟧
└─⟦this⟧ »../../dtia/release_sun_2.1/dtia_server.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦be254d495⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦be254d495⟧
└─⟦this⟧ »../../dtia/release_aix_2.1/dtia_server.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦c67979795⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦c67979795⟧
└─⟦this⟧ »../../dtia/release_hp_2.1/dtia_server.c«
#ifndef lint
#ifndef DEBUG
static char SCCS_id[] = "@(#)dtia_server.c 2.1 90/08/02 19:05:23 Copyright(c) 1990 by Rational.";
#else
static char SCCS_id[] = "@(#)dtia_server.c DEBUG 2.1 90/08/02 19:05:23 Copyright(c) 1990 by Rational.";
#endif
#endif
#include "dtia_server.h"
void usage(cmd)
char *cmd;
{
fprintf(stderr,"Usage: %s {no arguments}\n",cmd);
}
void stop() {
look_at_sons();
if (nb_sons()!=0) {
return;
}
exit (0);
}
void main(argc,argv)
int argc;
char *argv[];
{
int fd;
int pid;
struct timeval timeout;
int port;
signal(SIGINT,SIG_IGN);
/* Check Usage */
if (argc> 1) {
usage(argv[0]);
exit(1);
}
if (setuid(0)== -1) {
perror("setreuid");
exit(2);
}
if ((port=get_port())== -1) {
fprintf(stderr,"A Dtia server is already registered\n");
exit(3);
} else {
if (!ok_port(port)) {
fprintf(stderr,"Bad port number\n");
exit(4);
}
}
/* The socket + bind + listen */
if (init_connections() == -1) {
perror("connection");
exit(5);
}
init_sons();
switch (fork()) {
case -1:
perror("fork");
exit(7);
case 0:
/* let's carry on quietly on background */
close(0);
close(1);
close(2);
/* The son carries on in bk */
break;
default:
/* The father returns */
printf("Dtia server started\n");
fflush(stdout);
exit(0);
}
signal(SIGINT,stop);
/* main loop: */
/* - wait for a connection during timeout max and look */
/* for stopped sons (if any son running) */
/* - wait indefinitevely for a connection if no son */
timeout.tv_sec = timeout.tv_usec = 10;
while (1) {
int error;
char *host_name,*user_name;
do {
look_at_sons();
} while (wait_for_connection(&timeout)==0);
/* Accept one connection */
if ((fd = get_connection ())== -1) {
/* should never happen; if so ??? */
exit(8);
}
error=check_identity(fd,fd,&host_name,&user_name);
if ((error!=E_OK) && (error!=E_BAD_USER)) {
/* some connection error or something */
close(fd);
continue;
}
if (error==E_OK) {
/* regular case: let's fork a son for */
/* handling the connection */
signal(SIGINT,SIG_IGN);
/* the son does not have to execute the */
/* stop procedure (for the father only) */
switch ((pid=fork())) {
case -1:
break;
case 0:
/* The son handles the connection */
_exit(talk_connection (fd,fd)) ;
default:
add_son(pid,fd);
/* The father must take SIGINT */
/* correctly into account now */
/* that the son is running */
signal(SIGINT,stop);
}
} else {
/* Bad user_name or password */
}
}
}