summaryrefslogtreecommitdiff
path: root/kerberosIV
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2002-06-08 22:13:19 +0000
committerHans Insulander <hin@cvs.openbsd.org>2002-06-08 22:13:19 +0000
commitdf964edb7d293d02cbe087bfb4edf5c7c3460194 (patch)
tree881b248ea680b2e2f594dddd5471bcfb3506812b /kerberosIV
parent0bbe249c697876721b19577508c7077e42c9fcee (diff)
cvs put set/getprogname() stuff back. remove it once again.
Diffstat (limited to 'kerberosIV')
-rw-r--r--kerberosIV/src/appl/afsutil/kstring2key.c2
-rw-r--r--kerberosIV/src/appl/afsutil/pagsh.c2
-rw-r--r--kerberosIV/src/appl/bsd/osfc2.c4
-rw-r--r--kerberosIV/src/appl/bsd/rcmd_util.c22
-rw-r--r--kerberosIV/src/appl/ftp/ftp/main.c2
-rw-r--r--kerberosIV/src/appl/kauth/kauth.c2
-rw-r--r--kerberosIV/src/appl/kauth/kauthd.c2
-rw-r--r--kerberosIV/src/appl/popper/pop_init.c2
-rw-r--r--kerberosIV/src/appl/sample/sample_client.c2
-rw-r--r--kerberosIV/src/appl/sample/sample_server.c2
-rw-r--r--kerberosIV/src/appl/sample/simple_client.c2
-rw-r--r--kerberosIV/src/appl/sample/simple_server.c2
-rw-r--r--kerberosIV/src/appl/xnlock/xnlock.c2
-rw-r--r--kerberosIV/src/kadmin/ksrvutil.c2
-rw-r--r--kerberosIV/src/kuser/kinit.c2
-rw-r--r--kerberosIV/src/kuser/klist.c2
-rw-r--r--kerberosIV/src/lib/roken/getarg.c69
-rw-r--r--kerberosIV/src/lib/roken/print_version.c6
-rw-r--r--kerberosIV/src/lib/sl/sl.c133
-rw-r--r--kerberosIV/src/lib/vers/print_version.c2
-rw-r--r--kerberosIV/src/server/kerberos.c2
-rw-r--r--kerberosIV/src/slave/kpropd.c15
22 files changed, 228 insertions, 53 deletions
diff --git a/kerberosIV/src/appl/afsutil/kstring2key.c b/kerberosIV/src/appl/afsutil/kstring2key.c
index 5d74de8a147..32fd1bd0b85 100644
--- a/kerberosIV/src/appl/afsutil/kstring2key.c
+++ b/kerberosIV/src/appl/afsutil/kstring2key.c
@@ -56,7 +56,7 @@ usage(void)
{
fprintf(stderr,
"Usage: %s [-c AFS cellname] [ -5 krb5salt ] [ password ]\n",
- getprogname());
+ __progname);
fprintf(stderr,
" krb5salt is realmname APPEND principal APPEND instance\n");
exit(1);
diff --git a/kerberosIV/src/appl/afsutil/pagsh.c b/kerberosIV/src/appl/afsutil/pagsh.c
index 2a97bde629d..926cfcf45c9 100644
--- a/kerberosIV/src/appl/afsutil/pagsh.c
+++ b/kerberosIV/src/appl/afsutil/pagsh.c
@@ -69,8 +69,6 @@ main(int argc, char **argv)
char **args;
int i;
- set_progname(argv[0]);
-
do {
snprintf(tf, sizeof(tf), "%s%u_%u", TKT_ROOT, (unsigned int)getuid(),
(unsigned int)(getpid()*time(0)));
diff --git a/kerberosIV/src/appl/bsd/osfc2.c b/kerberosIV/src/appl/bsd/osfc2.c
index 229247e0fc6..ed0004a1b86 100644
--- a/kerberosIV/src/appl/bsd/osfc2.c
+++ b/kerberosIV/src/appl/bsd/osfc2.c
@@ -32,7 +32,7 @@
*/
#include "bsd_locl.h"
-RCSID("$KTH: osfc2.c,v 1.2 1999/12/02 16:58:28 joda Exp $");
+RCSID("$KTH: osfc2.c,v 1.3 2001/02/20 23:07:50 assar Exp $");
int
do_osfc2_magic(uid_t uid)
@@ -42,7 +42,7 @@ do_osfc2_magic(uid_t uid)
char *argv[2];
/* fake */
- argv[0] = (char*)__progname;
+ argv[0] = __progname;
argv[1] = NULL;
set_auth_parameters(1, argv);
diff --git a/kerberosIV/src/appl/bsd/rcmd_util.c b/kerberosIV/src/appl/bsd/rcmd_util.c
index 2d5699b4d48..c68ddbab9d5 100644
--- a/kerberosIV/src/appl/bsd/rcmd_util.c
+++ b/kerberosIV/src/appl/bsd/rcmd_util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#include "bsd_locl.h"
-RCSID("$KTH: rcmd_util.c,v 1.19 1999/12/02 16:58:28 joda Exp $");
+RCSID("$KTH: rcmd_util.c,v 1.23 2001/09/17 04:55:45 assar Exp $");
int
get_login_port(int kerberos, int encryption)
@@ -208,7 +208,7 @@ ip_options_and_die (int sock, struct sockaddr_in *fromp)
#if defined(IP_OPTIONS) && defined(HAVE_GETSOCKOPT)
u_char optbuf[BUFSIZ/3], *cp;
char lbuf[BUFSIZ], *lp;
- int optsize = sizeof(optbuf), ipproto;
+ socklen_t optsize = sizeof(optbuf), ipproto;
struct protoent *ip;
if ((ip = getprotobyname("ip")) != NULL)
@@ -245,3 +245,19 @@ warning(const char *fmt, ...)
}
va_end(args);
}
+
+/*
+ * setuid but work-around Linux 2.2.15 bug with setuid and capabilities
+ */
+
+void
+paranoid_setuid (uid_t uid)
+{
+ if (setuid (uid) < 0)
+ err (1, "setuid");
+ if (uid != 0 && setuid (0) == 0) {
+ syslog(LOG_ALERT | LOG_AUTH,
+ "Failed to drop privileges for uid %u", (unsigned)uid);
+ err (1, "setuid");
+ }
+}
diff --git a/kerberosIV/src/appl/ftp/ftp/main.c b/kerberosIV/src/appl/ftp/ftp/main.c
index c2f106aade7..968a9779274 100644
--- a/kerberosIV/src/appl/ftp/ftp/main.c
+++ b/kerberosIV/src/appl/ftp/ftp/main.c
@@ -125,7 +125,7 @@ main(int argc, char **argv)
exit(0);
signal(SIGINT, intr);
signal(SIGPIPE, lostpeer);
- xargv[0] = (char*)getprogname();
+ xargv[0] = __progname;
xargv[1] = argv[0];
xargv[2] = argv[1];
xargv[3] = argv[2];
diff --git a/kerberosIV/src/appl/kauth/kauth.c b/kerberosIV/src/appl/kauth/kauth.c
index 696e8fa73ab..e4a949560f3 100644
--- a/kerberosIV/src/appl/kauth/kauth.c
+++ b/kerberosIV/src/appl/kauth/kauth.c
@@ -60,7 +60,7 @@ usage(void)
" %s [-ad] [-n name] [-r remoteuser] [-t remote ticketfile]\n"
" [-l lifetime (in minutes) ] [-f srvtab ] [-c AFS cell name ]\n"
" [-h hosts... [--]] [command ... ]\n\n",
- getprogname(), getprogname());
+ __progname, __progname);
fprintf(stderr,
"A fully qualified name can be given: user[.instance][@realm]\n"
"Realm is converted to uppercase!\n");
diff --git a/kerberosIV/src/appl/kauth/kauthd.c b/kerberosIV/src/appl/kauth/kauthd.c
index 2c1dda582b9..700694c6e44 100644
--- a/kerberosIV/src/appl/kauth/kauthd.c
+++ b/kerberosIV/src/appl/kauth/kauthd.c
@@ -199,8 +199,6 @@ doit(int sock)
int
main (int argc, char **argv)
{
- set_progname(argv[0]);
-
openlog ("kauthd", LOG_ODELAY, LOG_AUTH);
if(argc > 1 && strcmp(argv[1], "-i") == 0)
diff --git a/kerberosIV/src/appl/popper/pop_init.c b/kerberosIV/src/appl/popper/pop_init.c
index 32da78117ac..b696a2fa64e 100644
--- a/kerberosIV/src/appl/popper/pop_init.c
+++ b/kerberosIV/src/appl/popper/pop_init.c
@@ -255,7 +255,7 @@ pop_init(POP *p,int argcount,char **argmessage)
memset (p, 0, sizeof(POP));
/* Save my name in a global variable */
- p->myname = (char*)getprogname();
+ p->myname = __progname;
/* Get the name of our host */
gethostname(p->myhost,MaxHostNameLen);
diff --git a/kerberosIV/src/appl/sample/sample_client.c b/kerberosIV/src/appl/sample/sample_client.c
index 27a0dc70f28..fd84577f4d5 100644
--- a/kerberosIV/src/appl/sample/sample_client.c
+++ b/kerberosIV/src/appl/sample/sample_client.c
@@ -29,7 +29,7 @@ static void
usage (void)
{
fprintf (stderr, "Usage: %s [-s service] [-p port] hostname checksum\n",
- getprogname());
+ __progname);
exit (1);
}
diff --git a/kerberosIV/src/appl/sample/sample_server.c b/kerberosIV/src/appl/sample/sample_server.c
index 74ac9ef4d15..2976adf1752 100644
--- a/kerberosIV/src/appl/sample/sample_server.c
+++ b/kerberosIV/src/appl/sample/sample_server.c
@@ -24,7 +24,7 @@ static void
usage (void)
{
fprintf (stderr, "Usage: %s [-i] [-s service] [-t srvtab]\n",
- getprogname());
+ __progname);
exit (1);
}
diff --git a/kerberosIV/src/appl/sample/simple_client.c b/kerberosIV/src/appl/sample/simple_client.c
index 0e3cf71423c..c50d2d6763f 100644
--- a/kerberosIV/src/appl/sample/simple_client.c
+++ b/kerberosIV/src/appl/sample/simple_client.c
@@ -160,7 +160,7 @@ static void
usage (void)
{
fprintf (stderr, "Usage: %s [-s service] [-p port] hostname\n",
- getprogname());
+ __progname);
exit (1);
}
diff --git a/kerberosIV/src/appl/sample/simple_server.c b/kerberosIV/src/appl/sample/simple_server.c
index 4a62267afe2..0d7cde44271 100644
--- a/kerberosIV/src/appl/sample/simple_server.c
+++ b/kerberosIV/src/appl/sample/simple_server.c
@@ -17,7 +17,7 @@ static void
usage (void)
{
fprintf (stderr, "Usage: %s [-p port] [-s service] [-t srvtab]\n",
- getprogname());
+ __progname);
exit (1);
}
diff --git a/kerberosIV/src/appl/xnlock/xnlock.c b/kerberosIV/src/appl/xnlock/xnlock.c
index deab72f8fe9..1b799a32863 100644
--- a/kerberosIV/src/appl/xnlock/xnlock.c
+++ b/kerberosIV/src/appl/xnlock/xnlock.c
@@ -199,7 +199,7 @@ get_words(void)
static void
usage(void)
{
- fprintf(stderr, "usage: %s [options] [message]\n", getprogname());
+ fprintf(stderr, "usage: %s [options] [message]\n", __progname);
fprintf(stderr, "-fg color foreground color\n");
fprintf(stderr, "-bg color background color\n");
fprintf(stderr, "-rv reverse foreground/background colors\n");
diff --git a/kerberosIV/src/kadmin/ksrvutil.c b/kerberosIV/src/kadmin/ksrvutil.c
index c72b9d7c3a1..06ca1d36e4c 100644
--- a/kerberosIV/src/kadmin/ksrvutil.c
+++ b/kerberosIV/src/kadmin/ksrvutil.c
@@ -537,7 +537,7 @@ main(int argc, char **argv)
dest_tkt();
}
else {
- com_err(getprogname(), status,
+ com_err(__progname, status,
" attempting to change password.");
dest_tkt();
/* XXX This knows the format of a keyfile */
diff --git a/kerberosIV/src/kuser/kinit.c b/kerberosIV/src/kuser/kinit.c
index 4da551379dd..de262d320c4 100644
--- a/kerberosIV/src/kuser/kinit.c
+++ b/kerberosIV/src/kuser/kinit.c
@@ -39,7 +39,7 @@ get_input(char *s, int size, FILE *stream)
static void
usage(void)
{
- fprintf(stderr, "Usage: %s [-irvlp] [name]\n", getprogname());
+ fprintf(stderr, "Usage: %s [-irvlp] [name]\n", __progname);
exit(1);
}
diff --git a/kerberosIV/src/kuser/klist.c b/kerberosIV/src/kuser/klist.c
index 4b7c2e8a9dc..fdefa991944 100644
--- a/kerberosIV/src/kuser/klist.c
+++ b/kerberosIV/src/kuser/klist.c
@@ -326,7 +326,7 @@ usage(void)
{
fprintf(stderr,
"Usage: %s [ -v | -s | -t ] [ -f filename ] [-tokens] [-srvtab ]\n",
- getprogname());
+ __progname);
exit(1);
}
diff --git a/kerberosIV/src/lib/roken/getarg.c b/kerberosIV/src/lib/roken/getarg.c
index 069df50a0cf..ce020ad6732 100644
--- a/kerberosIV/src/lib/roken/getarg.c
+++ b/kerberosIV/src/lib/roken/getarg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,10 +33,12 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: getarg.c,v 1.32 1999/12/02 16:58:46 joda Exp $");
+RCSID("$KTH: getarg.c,v 1.44 2001/09/10 13:22:43 assar Exp $");
#endif
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <roken.h>
#include "getarg.h"
@@ -56,11 +58,12 @@ print_arg (char *string, size_t len, int mdoc, int longp, struct getargs *arg)
if(longp)
strlcat(string, "= Ns", len);
strlcat(string, " Ar ", len);
- }else
+ } else {
if (longp)
strlcat (string, "=", len);
else
strlcat (string, " ", len);
+ }
if (arg->arg_help)
s = arg->arg_help;
@@ -68,6 +71,8 @@ print_arg (char *string, size_t len, int mdoc, int longp, struct getargs *arg)
s = "integer";
else if (arg->type == arg_string)
s = "string";
+ else if (arg->type == arg_strings)
+ s = "strings";
else if (arg->type == arg_double)
s = "float";
else
@@ -125,14 +130,16 @@ mandoc_template(struct getargs *args,
}
if(args[i].long_name) {
print_arg(buf, sizeof(buf), 1, 1, args + i);
- printf("Fl -%s%s", args[i].long_name, buf);
+ printf("Fl -%s%s%s",
+ args[i].type == arg_negative_flag ? "no-" : "",
+ args[i].long_name, buf);
}
printf("\n");
} else {
print_arg(buf, sizeof(buf), 1, 0, args + i);
printf(".Oo Fl %c%s \\*(Ba Xo\n", args[i].short_name, buf);
print_arg(buf, sizeof(buf), 1, 1, args + i);
- printf(".Fl -%s%s Oc\n.Xc\n", args[i].long_name, buf);
+ printf(".Fl -%s%s\n.Xc\n.Oc\n", args[i].long_name, buf);
}
/*
if(args[i].type == arg_strings)
@@ -155,7 +162,9 @@ mandoc_template(struct getargs *args,
printf("\n");
}
if(args[i].long_name){
- printf(".Fl -%s", args[i].long_name);
+ printf(".Fl -%s%s",
+ args[i].type == arg_negative_flag ? "no-" : "",
+ args[i].long_name);
print_arg(buf, sizeof(buf), 1, 1, args + i);
printf("%s\n", buf);
}
@@ -214,6 +223,23 @@ arg_printusage (struct getargs *args,
columns = 80;
col = 0;
col += fprintf (stderr, "Usage: %s", progname);
+ buf[0] = '\0';
+ for (i = 0; i < num_args; ++i) {
+ if(args[i].short_name && ISFLAG(args[i])) {
+ char s[2];
+ if(buf[0] == '\0')
+ strlcpy(buf, "[-", sizeof(buf));
+ s[0] = args[i].short_name;
+ s[1] = '\0';
+ strlcat(buf, s, sizeof(buf));
+ }
+ }
+ if(buf[0] != '\0') {
+ strlcat(buf, "]", sizeof(buf));
+ col = check_column(stderr, col, strlen(buf) + 1, columns);
+ col += fprintf(stderr, " %s", buf);
+ }
+
for (i = 0; i < num_args; ++i) {
size_t len = 0;
@@ -235,7 +261,7 @@ arg_printusage (struct getargs *args,
col = check_column(stderr, col, strlen(buf) + 1, columns);
col += fprintf(stderr, " %s", buf);
}
- if (args[i].short_name) {
+ if (args[i].short_name && !ISFLAG(args[i])) {
snprintf(buf, sizeof(buf), "[-%c", args[i].short_name);
len += 2;
len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
@@ -376,7 +402,11 @@ arg_match_long(struct getargs *args, size_t num_args,
*flag = !negate;
return 0;
} else if (*optarg && strcmp(optarg + 1, "maybe") == 0) {
+#ifdef HAVE_RANDOM
+ *flag = random() & 1;
+#else
*flag = rand() & 1;
+#endif
} else {
*flag = negate;
return 0;
@@ -389,13 +419,8 @@ arg_match_long(struct getargs *args, size_t num_args,
if (*optarg == '\0')
val = 1;
- else {
- char *endstr;
-
- val = strtol (optarg, &endstr, 0);
- if (endstr == optarg)
- return ARG_ERR_BAD_ARG;
- }
+ else if(sscanf(optarg + 1, "%d", &val) != 1)
+ return ARG_ERR_BAD_ARG;
*(int *)current->value += val;
return 0;
}
@@ -457,8 +482,10 @@ arg_match_short (struct getargs *args, size_t num_args,
++*optind;
optarg = rargv[*optind];
}
- if(optarg == NULL)
+ if(optarg == NULL) {
+ --*optind;
return ARG_ERR_NO_ARG;
+ }
if(args[k].type == arg_integer) {
int tmp;
if(sscanf(optarg, "%d", &tmp) != 1)
@@ -494,7 +521,13 @@ getarg(struct getargs *args, size_t num_args,
int i;
int ret = 0;
+#if defined(HAVE_SRANDOMDEV)
+ srandomdev();
+#elif defined(HAVE_RANDOM)
+ srandom(time(NULL));
+#else
srand (time(NULL));
+#endif
(*optind)++;
for(i = *optind; i < argc; i++) {
if(argv[i][0] != '-')
@@ -517,6 +550,12 @@ getarg(struct getargs *args, size_t num_args,
return ret;
}
+void
+free_getarg_strings (getarg_strings *s)
+{
+ free (s->strings);
+}
+
#if TEST
int foo_flag = 2;
int flag1 = 0;
diff --git a/kerberosIV/src/lib/roken/print_version.c b/kerberosIV/src/lib/roken/print_version.c
index a0fe4e5ea14..77ff7f80a4f 100644
--- a/kerberosIV/src/lib/roken/print_version.c
+++ b/kerberosIV/src/lib/roken/print_version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1998 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: print_version.c,v 1.5 1999/12/02 16:58:51 joda Exp $");
+RCSID("$KTH: print_version.c,v 1.8 2001/02/20 01:44:55 assar Exp $");
#endif
#include "roken.h"
@@ -72,7 +72,7 @@ print_version(const char *progname)
}
}
fprintf(stderr, "%s (%s)\n", progname, msg);
- fprintf(stderr, "Copyright (c) 1999 Kungliga Tekniska Högskolan\n");
+ fprintf(stderr, "Copyright (c) 1999 - 2001 Kungliga Tekniska Högskolan\n");
if(num_args != 0)
free(msg);
}
diff --git a/kerberosIV/src/lib/sl/sl.c b/kerberosIV/src/lib/sl/sl.c
index 24d837cf160..a73116b78fd 100644
--- a/kerberosIV/src/lib/sl/sl.c
+++ b/kerberosIV/src/lib/sl/sl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,10 +33,101 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: sl.c,v 1.25 1999/12/02 16:58:55 joda Exp $");
+RCSID("$KTH: sl.c,v 1.29 2001/02/20 01:44:55 assar Exp $");
#endif
#include "sl_locl.h"
+#include <setjmp.h>
+
+static size_t
+print_sl (FILE *stream, int mdoc, int longp, SL_cmd *c)
+ __attribute__ ((unused));
+
+static size_t
+print_sl (FILE *stream, int mdoc, int longp, SL_cmd *c)
+{
+ if(mdoc){
+ if(longp)
+ fprintf(stream, "= Ns");
+ fprintf(stream, " Ar ");
+ }else
+ if (longp)
+ putc ('=', stream);
+ else
+ putc (' ', stream);
+
+ return 1;
+}
+
+static void
+mandoc_template(SL_cmd *cmds,
+ const char *extra_string)
+{
+ SL_cmd *c, *prev;
+ char timestr[64], cmd[64];
+ const char *p;
+ time_t t;
+
+ printf(".\\\" Things to fix:\n");
+ printf(".\\\" * correct section, and operating system\n");
+ printf(".\\\" * remove Op from mandatory flags\n");
+ printf(".\\\" * use better macros for arguments (like .Pa for files)\n");
+ printf(".\\\"\n");
+ t = time(NULL);
+ strftime(timestr, sizeof(timestr), "%b %d, %Y", localtime(&t));
+ printf(".Dd %s\n", timestr);
+ p = strrchr(__progname, '/');
+ if(p) p++; else p = __progname;
+ strncpy(cmd, p, sizeof(cmd));
+ cmd[sizeof(cmd)-1] = '\0';
+ strupr(cmd);
+
+ printf(".Dt %s SECTION\n", cmd);
+ printf(".Os OPERATING_SYSTEM\n");
+ printf(".Sh NAME\n");
+ printf(".Nm %s\n", p);
+ printf(".Nd\n");
+ printf("in search of a description\n");
+ printf(".Sh SYNOPSIS\n");
+ printf(".Nm\n");
+ for(c = cmds; c->name; ++c) {
+/* if (c->func == NULL)
+ continue; */
+ printf(".Op Fl %s", c->name);
+/* print_sl(stdout, 1, 0, c);*/
+ printf("\n");
+
+ }
+ if (extra_string && *extra_string)
+ printf (".Ar %s\n", extra_string);
+ printf(".Sh DESCRIPTION\n");
+ printf("Supported options:\n");
+ printf(".Bl -tag -width Ds\n");
+ prev = NULL;
+ for(c = cmds; c->name; ++c) {
+ if (c->func) {
+ if (prev)
+ printf ("\n%s\n", prev->usage);
+
+ printf (".It Fl %s", c->name);
+ prev = c;
+ } else
+ printf (", %s\n", c->name);
+ }
+ if (prev)
+ printf ("\n%s\n", prev->usage);
+
+ printf(".El\n");
+ printf(".\\\".Sh ENVIRONMENT\n");
+ printf(".\\\".Sh FILES\n");
+ printf(".\\\".Sh EXAMPLES\n");
+ printf(".\\\".Sh DIAGNOSTICS\n");
+ printf(".\\\".Sh SEE ALSO\n");
+ printf(".\\\".Sh STANDARDS\n");
+ printf(".\\\".Sh HISTORY\n");
+ printf(".\\\".Sh AUTHORS\n");
+ printf(".\\\".Sh BUGS\n");
+}
static SL_cmd *
sl_match (SL_cmd *cmds, char *cmd, int exactp)
@@ -66,6 +157,11 @@ sl_help (SL_cmd *cmds, int argc, char **argv)
{
SL_cmd *c, *prev_c;
+ if (getenv("SLMANDOC")) {
+ mandoc_template(cmds, NULL);
+ return;
+ }
+
if (argc == 1) {
prev_c = NULL;
for (c = cmds; c->name; ++c) {
@@ -178,9 +274,28 @@ sl_make_argv(char *line, int *ret_argc, char ***ret_argv)
return 0;
}
+static jmp_buf sl_jmp;
+
+static void sl_sigint(int sig)
+{
+ longjmp(sl_jmp, 1);
+}
+
+static char *sl_readline(const char *prompt)
+{
+ char *s;
+ void (*old)(int);
+ old = signal(SIGINT, sl_sigint);
+ if(setjmp(sl_jmp))
+ printf("\n");
+ s = readline((char*)prompt);
+ signal(SIGINT, old);
+ return s;
+}
+
/* return values: 0 on success, -1 on fatal error, or return value of command */
int
-sl_command_loop(SL_cmd *cmds, char *prompt, void **data)
+sl_command_loop(SL_cmd *cmds, const char *prompt, void **data)
{
int ret = 0;
char *buf;
@@ -188,7 +303,7 @@ sl_command_loop(SL_cmd *cmds, char *prompt, void **data)
char **argv;
ret = 0;
- buf = readline(prompt);
+ buf = sl_readline(prompt);
if(buf == NULL)
return 1;
@@ -213,7 +328,7 @@ sl_command_loop(SL_cmd *cmds, char *prompt, void **data)
}
int
-sl_loop(SL_cmd *cmds, char *prompt)
+sl_loop(SL_cmd *cmds, const char *prompt)
{
void *data = NULL;
int ret;
@@ -221,3 +336,11 @@ sl_loop(SL_cmd *cmds, char *prompt)
;
return ret;
}
+
+void
+sl_apropos (SL_cmd *cmd, const char *topic)
+{
+ for (; cmd->name != NULL; ++cmd)
+ if (cmd->usage != NULL && strstr(cmd->usage, topic) != NULL)
+ printf ("%-20s%s\n", cmd->name, cmd->usage);
+}
diff --git a/kerberosIV/src/lib/vers/print_version.c b/kerberosIV/src/lib/vers/print_version.c
index 11a6934428b..2b85fe8c123 100644
--- a/kerberosIV/src/lib/vers/print_version.c
+++ b/kerberosIV/src/lib/vers/print_version.c
@@ -49,7 +49,7 @@ print_version(const char *progname)
int i;
if(progname == NULL)
- progname = getprogname();
+ progname = __progname;
if(num_args == 0)
msg = "no version information";
diff --git a/kerberosIV/src/server/kerberos.c b/kerberosIV/src/server/kerberos.c
index d87a2c575ef..2425b6d04a7 100644
--- a/kerberosIV/src/server/kerberos.c
+++ b/kerberosIV/src/server/kerberos.c
@@ -128,7 +128,7 @@ usage(void)
fprintf(stderr, "Usage: %s [-s] [-m] [-n] [-p pause_seconds]"
" [-a max_age] [-l log_file] [-i address_to_listen_on]"
" [-r realm] [database_pathname]\n",
- getprogname());
+ __progname);
exit(1);
}
diff --git a/kerberosIV/src/slave/kpropd.c b/kerberosIV/src/slave/kpropd.c
index 2acf38e80cf..d0f179f8707 100644
--- a/kerberosIV/src/slave/kpropd.c
+++ b/kerberosIV/src/slave/kpropd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -35,7 +35,7 @@
#include "kprop.h"
-RCSID("$KTH: kpropd.c,v 2.32 1999/12/02 16:58:56 joda Exp $");
+RCSID("$KTH: kpropd.c,v 2.35 2001/09/17 04:56:46 assar Exp $");
#ifndef SBINDIR
#define SBINDIR "/usr/athena/sbin"
@@ -107,6 +107,7 @@ int
kprop(int s)
{
char buf[128];
+ socklen_t sock_len;
int n;
KTEXT_ST ticket;
AUTH_DAT ad;
@@ -116,14 +117,14 @@ kprop(int s)
int kerr;
int lock;
- n = sizeof(master);
- if(getpeername(s, (struct sockaddr*)&master, &n) < 0){
+ sock_len = sizeof(master);
+ if(getpeername(s, (struct sockaddr*)&master, &sock_len) < 0){
klog(L_KRB_PERR, "getpeername: %s", strerror(errno));
return 1;
}
- n = sizeof(slave);
- if(getsockname(s, (struct sockaddr*)&slave, &n) < 0){
+ sock_len = sizeof(slave);
+ if(getsockname(s, (struct sockaddr*)&slave, &sock_len) < 0){
klog(L_KRB_PERR, "getsockname: %s", strerror(errno));
return 1;
}
@@ -212,7 +213,7 @@ static int
doit_interactive(void)
{
struct sockaddr_in sa;
- int salen;
+ socklen_t salen;
int s, s2;
int ret;