summaryrefslogtreecommitdiff
path: root/libexec/identd
diff options
context:
space:
mode:
authorHugh Graham <hugh@cvs.openbsd.org>2001-04-15 23:48:17 +0000
committerHugh Graham <hugh@cvs.openbsd.org>2001-04-15 23:48:17 +0000
commit420542eac6b2a2ea081757507d99469d00de1411 (patch)
tree6cfc2d828c028c33379e38e4009c88801ecca433 /libexec/identd
parent8a1460d1bbefded143a3197d62b0a666e5695840 (diff)
Replace a bunch of conditional expressions with global pointers.
Requested and checked by millert.
Diffstat (limited to 'libexec/identd')
-rw-r--r--libexec/identd/identd.c10
-rw-r--r--libexec/identd/identd.h5
-rw-r--r--libexec/identd/parse.c42
3 files changed, 20 insertions, 37 deletions
diff --git a/libexec/identd/identd.c b/libexec/identd/identd.c
index 541fcc8985c..fd6fce83c3a 100644
--- a/libexec/identd/identd.c
+++ b/libexec/identd/identd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: identd.c,v 1.17 2001/04/13 20:16:53 millert Exp $ */
+/* $OpenBSD: identd.c,v 1.18 2001/04/15 23:48:15 hugh Exp $ */
/*
* This program is in the public domain and may be used freely by anyone
@@ -41,7 +41,6 @@ int verbose_flag = 0;
int debug_flag = 0;
int syslog_flag = 0;
int multi_flag = 0;
-int other_flag = 0;
int unknown_flag = 0;
int number_flag = 0;
int noident_flag = 0;
@@ -51,7 +50,9 @@ int token_flag = 0;
int lport = 0;
int fport = 0;
-char *charset_name = NULL;
+const char *opsys_name = "UNIX";
+const char *charset_sep = "";
+char *charset_name = "";
char *indirect_host = NULL;
char *indirect_password = NULL;
@@ -203,6 +204,7 @@ main(argc, argv)
break;
case 'c':
charset_name = optarg;
+ charset_sep = " , ";
break;
case 'r':
indirect_host = optarg;
@@ -211,7 +213,7 @@ main(argc, argv)
syslog_flag++;
break;
case 'o':
- other_flag = 1;
+ opsys_name = "OTHER";
break;
case 'e':
unknown_flag = 1;
diff --git a/libexec/identd/identd.h b/libexec/identd/identd.h
index ef049d1cbee..a0f0e2f9ee8 100644
--- a/libexec/identd/identd.h
+++ b/libexec/identd/identd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: identd.h,v 1.7 2001/04/13 20:16:53 millert Exp $*/
+/* $OpenBSD: identd.h,v 1.8 2001/04/15 23:48:16 hugh Exp $*/
/*
**
@@ -24,13 +24,14 @@ extern int verbose_flag;
extern int debug_flag;
extern int syslog_flag;
extern int multi_flag;
-extern int other_flag;
extern int unknown_flag;
extern int number_flag;
extern int noident_flag;
extern int token_flag;
extern int userident_flag;
+extern const char *opsys_name;
+extern const char *charset_sep;
extern char *charset_name;
extern char *indirect_host;
extern char *indirect_password;
diff --git a/libexec/identd/parse.c b/libexec/identd/parse.c
index de7a26379a8..b31cd83f049 100644
--- a/libexec/identd/parse.c
+++ b/libexec/identd/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.22 2001/04/14 02:49:19 hugh Exp $ */
+/* $OpenBSD: parse.c,v 1.23 2001/04/15 23:48:16 hugh Exp $ */
/*
* This program is in the public domain and may be used freely by anyone
@@ -280,9 +280,7 @@ parse(fd, laddr, faddr)
uid);
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%d\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", uid);
+ lport, fport, opsys_name, charset_sep, charset_name, uid);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost(faddr));
return 1;
@@ -313,9 +311,7 @@ parse(fd, laddr, faddr)
token, uid, pw->pw_name);
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%s\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", token);
+ lport, fport, opsys_name, charset_sep, charset_name, token);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost(faddr));
return 1;
@@ -329,9 +325,7 @@ parse(fd, laddr, faddr)
pw->pw_name);
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%s\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", token);
+ lport, fport, opsys_name, charset_sep, charset_name, token);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost(faddr));
return 1;
@@ -342,9 +336,7 @@ parse(fd, laddr, faddr)
if (number_flag) {
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%d\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", uid);
+ lport, fport, opsys_name, charset_sep, charset_name, uid);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost(faddr));
return 1;
@@ -352,9 +344,7 @@ parse(fd, laddr, faddr)
return 0;
}
n = snprintf(buf, sizeof(buf), "%d , %d : USERID : %s%s%s :%s\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", pw->pw_name);
+ lport, fport, opsys_name, charset_sep, charset_name, pw->pw_name);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost(faddr));
return 1;
@@ -458,9 +448,7 @@ parse6(fd, laddr, faddr)
uid);
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%d\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", uid);
+ lport, fport, opsys_name, charset_sep, charset_name, uid);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost6(faddr));
return 1;
@@ -491,9 +479,7 @@ parse6(fd, laddr, faddr)
token, uid, pw->pw_name);
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%s\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", token);
+ lport, fport, opsys_name, charset_sep, charset_name, token);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost6(faddr));
return 1;
@@ -507,9 +493,7 @@ parse6(fd, laddr, faddr)
pw->pw_name);
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%s\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", token);
+ lport, fport, opsys_name, charset_sep, charset_name, token);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost6(faddr));
return 1;
@@ -520,9 +504,7 @@ parse6(fd, laddr, faddr)
if (number_flag) {
n = snprintf(buf, sizeof(buf),
"%d , %d : USERID : %s%s%s :%d\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", uid);
+ lport, fport, opsys_name, charset_sep, charset_name, uid);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost6(faddr));
return 1;
@@ -531,9 +513,7 @@ parse6(fd, laddr, faddr)
}
n = snprintf(buf, sizeof(buf), "%d , %d : USERID : %s%s%s :%s\r\n",
- lport, fport, other_flag ? "OTHER" : "UNIX",
- charset_name ? " , " : "",
- charset_name ? charset_name : "", pw->pw_name);
+ lport, fport, opsys_name, charset_sep, charset_name, pw->pw_name);
if (timed_write(fd, buf, n, IO_TIMEOUT) != n && syslog_flag) {
syslog(LOG_NOTICE, "write to %s: %m", gethost6(faddr));
return 1;