From 7c766bf44d652f4f4ffad199c3fc556f82195d1f Mon Sep 17 00:00:00 2001 From: wens Date: Thu, 10 Apr 2008 04:17:08 +0000 Subject: Change tobind/toconnect interface. **OUTTACACHE is now UTMPD** git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4121 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- daemon/fromd/fromd.c | 13 +++++-------- daemon/utmpd/authserver.c | 11 ++++------- daemon/utmpd/utmpserver.c | 13 +++++-------- daemon/utmpd/utmpserver2.c | 11 ++++------- daemon/utmpd/utmpserver3.c | 11 ++++------- daemon/utmpd/utmpsync.c | 2 +- 6 files changed, 23 insertions(+), 38 deletions(-) (limited to 'daemon') diff --git a/daemon/fromd/fromd.c b/daemon/fromd/fromd.c index 5e080f7c..de1ad44c 100644 --- a/daemon/fromd/fromd.c +++ b/daemon/fromd/fromd.c @@ -76,26 +76,23 @@ void daemonize() int main(int argc, char *argv[]) { - int ch, port = 5130, sfd; - char *iface_ip = NULL; + int ch, sfd; + char *iface_ip = ":5130"; Signal(SIGPIPE, SIG_IGN); - while ( (ch = getopt(argc, argv, "p:i:h")) != -1 ) + while ( (ch = getopt(argc, argv, "i:h")) != -1 ) switch( ch ){ - case 'p': - port = atoi(optarg); - break; case 'i': iface_ip = optarg; break; case 'h': default: - fprintf(stderr, "usage: %s [-i interface_ip] [-p port]\n", argv[0]); + fprintf(stderr, "usage: %s [-i [interface_ip]:port]\n", argv[0]); return 1; } - if ( (sfd = tobind(iface_ip, port)) < 0 ) + if ( (sfd = tobind(iface_ip)) < 0 ) return 1; daemonize(); diff --git a/daemon/utmpd/authserver.c b/daemon/utmpd/authserver.c index 5fbba03a..ce728fa9 100644 --- a/daemon/utmpd/authserver.c +++ b/daemon/utmpd/authserver.c @@ -206,21 +206,18 @@ void connection_accept(int fd, short event, void *arg) int main(int argc, char *argv[]) { - int ch, port = 5121, sfd; - char *iface_ip = NULL; + int ch, sfd; + char *iface_ip = ":5121"; Signal(SIGPIPE, SIG_IGN); - while( (ch = getopt(argc, argv, "p:i:h")) != -1 ) + while( (ch = getopt(argc, argv, "i:h")) != -1 ) switch( ch ){ - case 'p': - port = atoi(optarg); - break; case 'i': iface_ip = optarg; break; case 'h': default: - fprintf(stderr, "usage: authserver [-i interface_ip] [-p port]\n"); + fprintf(stderr, "usage: authserver [-i [interface_ip]:port]\n"); return 1; } diff --git a/daemon/utmpd/utmpserver.c b/daemon/utmpd/utmpserver.c index 19005a80..62b54a41 100644 --- a/daemon/utmpd/utmpserver.c +++ b/daemon/utmpd/utmpserver.c @@ -148,25 +148,22 @@ void flushwaitqueue(void) int main(int argc, char **argv) { struct sockaddr_in clientaddr; - int ch, port = 5120, sfd, cfd, len, index, uid; - char *iface_ip = NULL; + int ch, sfd, cfd, len, index, uid; + char *iface_ip = ":5120"; Signal(SIGPIPE, SIG_IGN); - while( (ch = getopt(argc, argv, "p:i:h")) != -1 ) + while( (ch = getopt(argc, argv, "i:h")) != -1 ) switch( ch ){ - case 'p': - port = atoi(optarg); - break; case 'i': iface_ip = optarg; break; case 'h': default: - fprintf(stderr, "usage: utmpserver [-i interface_ip] [-p port]\n"); + fprintf(stderr, "usage: utmpserver [-i [interface_ip]:port]\n"); return 1; } - if( (sfd = tobind(iface_ip, port)) < 0 ) + if( (sfd = tobind(iface_ip)) < 0 ) return 1; #ifdef NOFLOODING diff --git a/daemon/utmpd/utmpserver2.c b/daemon/utmpd/utmpserver2.c index 12c3a299..aca43245 100644 --- a/daemon/utmpd/utmpserver2.c +++ b/daemon/utmpd/utmpserver2.c @@ -183,8 +183,8 @@ void showstat(void) int main(int argc, char *argv[]) { struct sockaddr_in clientaddr; - int ch, port = 5120, sfd, cfd, len; - char *iface_ip = NULL; + int ch, sfd, cfd, len; + char *iface_ip = ":5120"; int cmd; int uid,index; int fail; @@ -199,17 +199,14 @@ int main(int argc, char *argv[]) #endif Signal(SIGPIPE, SIG_IGN); - while( (ch = getopt(argc, argv, "p:i:h")) != -1 ) + while( (ch = getopt(argc, argv, "i:h")) != -1 ) switch( ch ){ - case 'p': - port = atoi(optarg); - break; case 'i': iface_ip = optarg; break; case 'h': default: - fprintf(stderr, "usage: utmpserver [-i interface_ip] [-p port]\n"); + fprintf(stderr, "usage: utmpserver [-i [interface_ip]:port]\n"); return 1; } diff --git a/daemon/utmpd/utmpserver3.c b/daemon/utmpd/utmpserver3.c index 0e1eef02..de112802 100644 --- a/daemon/utmpd/utmpserver3.c +++ b/daemon/utmpd/utmpserver3.c @@ -304,8 +304,8 @@ void connection_accept(int fd, short event, void *arg) int main(int argc, char *argv[]) { - int ch, port = 5120, sfd; - char *iface_ip = NULL; + int ch, sfd; + char *iface_ip = ":5120"; #ifdef UTMPLOG logfp = fopen("utmp.log","a"); @@ -316,17 +316,14 @@ int main(int argc, char *argv[]) #endif Signal(SIGPIPE, SIG_IGN); - while( (ch = getopt(argc, argv, "p:i:h")) != -1 ) + while( (ch = getopt(argc, argv, "i:h")) != -1 ) switch( ch ){ - case 'p': - port = atoi(optarg); - break; case 'i': iface_ip = optarg; break; case 'h': default: - fprintf(stderr, "usage: utmpserver [-i interface_ip] [-p port]\n"); + fprintf(stderr, "usage: utmpserver [-i [interface_ip]:port]\n"); return 1; } diff --git a/daemon/utmpd/utmpsync.c b/daemon/utmpd/utmpsync.c index 69d1c623..53f61ac0 100644 --- a/daemon/utmpd/utmpsync.c +++ b/daemon/utmpd/utmpsync.c @@ -8,7 +8,7 @@ int main(int argc, char **argv) { int sfd, index, i; attach_SHM(); - if( (sfd = toconnect(OUTTACACHEHOST, OUTTACACHEPORT)) < 0 ) { + if( (sfd = toconnect(UTMPD_ADDR)) < 0 ) { printf("connect fail\n"); return 1; } -- cgit v1.2.3