summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2001-07-06 00:18:48 +0000
committerEzra Peisach <epeisach@mit.edu>2001-07-06 00:18:48 +0000
commitd63bccc70e56809eee2a7ac0ddbc0f4616ee4282 (patch)
tree06fe94352b25977faae21461b9c742e625190055
parent092c5749b8a7776bde573133976a21fc0f5c1e48 (diff)
downloadkrb5-d63bccc70e56809eee2a7ac0ddbc0f4616ee4282.tar.gz
krb5-d63bccc70e56809eee2a7ac0ddbc0f4616ee4282.tar.xz
krb5-d63bccc70e56809eee2a7ac0ddbc0f4616ee4282.zip
* Makefile.in: Link krshd with KRSHDLIBS instead of LOGINLIBS
* configure.in: Creare a new variable KRSHDLIBS which differs from LOGINLIBS by not including libkrb524.a. Test for getenv. * krcp.c: Prototype lostconn(). * krlogind.c: Provide prototype for signal handler cleanup. Implied need to add extra argument to function - ensure consistant calling. * krsh.c: Provide prototype for signal handler sendsig. * krshd.c: Rewrite error() to use stdargs/varargs. (doit): When creating a tty name using getpid. Ensure that does not overflow tty string buffer. * login.c: Provide prototype for signal handler timedout. * setenv.c: Do not define getenv() unless needed. * v4rcp.c: Rewrite error() to use stdargs/varargs. Add signal number argument to lostconn(), include prototype, and ensure called consistantly. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13567 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/appl/bsd/ChangeLog27
-rw-r--r--src/appl/bsd/Makefile.in5
-rw-r--r--src/appl/bsd/configure.in7
-rw-r--r--src/appl/bsd/krcp.c9
-rw-r--r--src/appl/bsd/krlogind.c9
-rw-r--r--src/appl/bsd/krsh.c2
-rw-r--r--src/appl/bsd/krshd.c41
-rw-r--r--src/appl/bsd/login.c6
-rw-r--r--src/appl/bsd/setenv.c14
-rw-r--r--src/appl/bsd/v4rcp.c57
10 files changed, 133 insertions, 44 deletions
diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog
index 0fdd771812..b46a81c25a 100644
--- a/src/appl/bsd/ChangeLog
+++ b/src/appl/bsd/ChangeLog
@@ -1,3 +1,30 @@
+2001-07-05 Ezra Peisach <epeisach@mit.edu>
+
+ * Makefile.in: Link krshd with KRSHDLIBS instead of LOGINLIBS.
+
+ * configure.in: Creare a new variable KRSHDLIBS which differs from
+ LOGINLIBS by not including libkrb524.a. Test for getenv.
+
+ * krcp.c: Prototype lostconn().
+
+ * krlogind.c: Provide prototype for signal handler cleanup. Implied
+ need to add extra argument to function - ensure consistant
+ calling.
+
+ * krsh.c: Provide prototype for signal handler sendsig.
+
+ * krshd.c: Rewrite error() to use stdargs/varargs.
+ (doit): When creating a tty name using getpid. Ensure that does
+ not overflow tty string buffer.
+
+ * login.c: Provide prototype for signal handler timedout.
+
+ * setenv.c: Do not define getenv() unless needed.
+
+ * v4rcp.c: Rewrite error() to use stdargs/varargs. Add signal
+ number argument to lostconn(), include prototype, and ensure
+ called consistantly.
+
2001-07-03 Ezra Peisach <epeisach@mit.edu>
* v4rcp.c, login.c: Fill in prototypes, declare many functions static.
diff --git a/src/appl/bsd/Makefile.in b/src/appl/bsd/Makefile.in
index d95bfcdbec..7e32583021 100644
--- a/src/appl/bsd/Makefile.in
+++ b/src/appl/bsd/Makefile.in
@@ -9,10 +9,11 @@ PROG_RPATH=$(KRB5_LIBDIR)
SETENVSRC=@SETENVSRC@
SETENVOBJ=@SETENVOBJ@
-LOGINLIBS =@LOGINLIBS@
+LOGINLIBS=@LOGINLIBS@
LIBOBJS=@LIBOBJS@
V4RCP=@V4RCP@
V4RCPO=@V4RCPO@
+KRSHDLIBS=@KRSHDLIBS@
SRCS= krcp.c krlogin.c krsh.c kcmd.c forward.c $(SETENVSRC) \
login.c krshd.c krlogind.c v4rcp.c
@@ -64,7 +65,7 @@ install::
fi
kshd: krshd.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(PTY_DEPLIB) $(UTIL_DEPLIB) $(KRB4COMPAT_DEPLIBS)
- $(CC_LINK) -o kshd krshd.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(LOGINLIBS) $(PTY_LIB) $(UTIL_LIB) $(KRB4COMPAT_LIBS)
+ $(CC_LINK) -o kshd krshd.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(KRSHDLIBS) $(PTY_LIB) $(UTIL_LIB) $(KRB4COMPAT_LIBS)
klogind: krlogind.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(PTY_DEPLIB) $(UTIL_DEPLIB) $(KRB4COMPAT_DEPLIBS)
$(CC_LINK) -o klogind krlogind.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(PTY_LIB) $(UTIL_LIB) $(KRB4COMPAT_LIBS)
diff --git a/src/appl/bsd/configure.in b/src/appl/bsd/configure.in
index 84a898aad0..7471d7d456 100644
--- a/src/appl/bsd/configure.in
+++ b/src/appl/bsd/configure.in
@@ -44,6 +44,10 @@ alpha*-dec-osf*)
ac_cv_header_termios_h=no
;;
esac
+dnl
+dnl krshd does not use krb524...
+dnl
+KRSHDLIBS="$LOGINLIBS"
dnl
dnl After beta6 this functionality will be integrated with aclocal.m4
AC_ARG_WITH([krb4],
@@ -65,13 +69,14 @@ else
fi
dnl
dnl
+AC_SUBST(KRSHDLIBS)
AC_SUBST(LOGINLIBS)
AC_SUBST(V4RCP)
AC_SUBST(V4RCPO)
dnl
AC_FUNC_VFORK
AC_TYPE_MODE_T
-AC_CHECK_FUNCS(isatty inet_aton gettosbyname killpg initgroups setpriority setreuid setresuid waitpid setsid ptsname setlogin tcgetpgrp tcsetpgrp setpgid strsave utimes rmufile)
+AC_CHECK_FUNCS(isatty inet_aton getenv gettosbyname killpg initgroups setpriority setreuid setresuid waitpid setsid ptsname setlogin tcgetpgrp tcsetpgrp setpgid strsave utimes rmufile)
AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h utmp.h sys/time.h krb4-proto.h sys/ioctl_compat.h paths.h arpa/nameser.h)
AC_HEADER_STDARG
AC_REPLACE_FUNCS(getdtablesize)
diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c
index bf133c2a7c..d36d50cd64 100644
--- a/src/appl/bsd/krcp.c
+++ b/src/appl/bsd/krcp.c
@@ -117,7 +117,7 @@ int encryptflag = 0;
int rem;
char *colon(char *);
int errs;
-krb5_sigtype lostconn();
+krb5_sigtype lostconn(int);
int iamremote, targetshouldbedirectory;
int iamrecursive;
int pflag;
@@ -918,7 +918,7 @@ int response()
{
char resp, c, rbuf[RCP_BUFSIZ], *cp = rbuf;
if (rcmd_stream_read(rem, &resp, 1, 0) != 1)
- lostconn();
+ lostconn(0);
switch (resp) {
case 0: /* ok */
@@ -931,7 +931,7 @@ int response()
case 2: /* fatal error, "" */
do {
if (rcmd_stream_read(rem, &c, 1, 0) != 1)
- lostconn();
+ lostconn(0);
*cp++ = c;
} while (cp < &rbuf[RCP_BUFSIZ] && c != '\n');
if (iamremote == 0)
@@ -947,7 +947,8 @@ int response()
krb5_sigtype
- lostconn()
+ lostconn(signumber)
+ int signumber;
{
if (iamremote == 0)
fprintf(stderr, "rcp: lost connection\n");
diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c
index 2bced2adf5..a4b835df89 100644
--- a/src/appl/bsd/krlogind.c
+++ b/src/appl/bsd/krlogind.c
@@ -325,7 +325,7 @@ extern int daemon(int, int);
void fatal(int, const char *), fatalperror(int, const char *), doit(int, struct sockaddr_in *), usage(void), do_krb_login(char *, char *), getstr(int, char *, int, char *);
void protocol(int, int);
int princ_maps_to_lname(krb5_principal, char *), default_realm(krb5_principal);
-krb5_sigtype cleanup();
+krb5_sigtype cleanup(int);
krb5_error_code recvauth(int *);
/* There are two authentication related masks:
@@ -897,7 +897,7 @@ void doit(f, fromp)
#endif
protocol(f, p);
signal(SIGCHLD, SIG_IGN);
- cleanup();
+ cleanup(0);
}
unsigned char magic[2] = { 0377, 0377 };
@@ -1146,7 +1146,8 @@ void protocol(f, p)
-krb5_sigtype cleanup()
+krb5_sigtype cleanup(signumber)
+ int signumber;
{
pty_cleanup (line, pid, 1);
shutdown(netf, 2);
@@ -1188,7 +1189,7 @@ void fatal(f, msg)
#else
(void) ioctl(f, TCFLSH, out);
#endif
- cleanup();
+ cleanup(0);
}
exit(1);
}
diff --git a/src/appl/bsd/krsh.c b/src/appl/bsd/krsh.c
index 8ec9980bd0..bcedf8a00c 100644
--- a/src/appl/bsd/krsh.c
+++ b/src/appl/bsd/krsh.c
@@ -85,7 +85,7 @@ int error();
int options;
int rfd2;
int nflag;
-krb5_sigtype sendsig();
+krb5_sigtype sendsig(int);
#ifdef KERBEROS
diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c
index 1fd63f929b..bc0cdc5925 100644
--- a/src/appl/bsd/krshd.c
+++ b/src/appl/bsd/krshd.c
@@ -119,6 +119,11 @@ char copyright[] =
#include <sys/audit.h>
#include <pwdadj.h>
#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
#include <signal.h>
#if !defined(KERBEROS) || !defined(KRB5_KRB4_COMPAT)
@@ -252,8 +257,11 @@ int secflag;
extern
#endif /* CRAY */
-/*VARARGS1*/
-void error();
+void error (char *fmt, ...)
+#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
+ __attribute__ ((__format__ (__printf__, 1, 2)))
+#endif
+ ;
void usage(void), getstr(int, char *, int, char *),
doit(int, struct sockaddr_in *);
@@ -563,7 +571,7 @@ int auth_sys = 0; /* Which version of Kerberos used to authenticate */
#define KRB5_RECVAUTH_V4 4
#define KRB5_RECVAUTH_V5 5
-krb5_sigtype
+static krb5_sigtype
cleanup(signumber)
int signumber;
{
@@ -935,7 +943,7 @@ void doit(f, fromp)
privileges. */
if (port) {
/* Place entry into wtmp */
- sprintf(ttyn,"krsh%1d",getpid());
+ sprintf(ttyn,"krsh%ld",(long) (getpid() % 9999999));
pty_logwtmp(ttyn,locuser,sane_host);
}
/* We are simply execing a program over rshd : log entry into wtmp,
@@ -1531,16 +1539,29 @@ if(port)
+void
+#ifdef HAVE_STDARG_H
+error(char *fmt, ...)
+#else
/*VARARGS1*/
-void error(fmt, a1, a2, a3)
+error(fmt, va_alist)
char *fmt;
- char *a1, *a2, *a3;
+ va_dcl
+#endif
{
- char buf[RCMD_BUFSIZ];
+ va_list ap;
+ char buf[RCMD_BUFSIZ], *cp = buf;
- buf[0] = 1;
- (void) sprintf(buf+1, "%s: ", progname);
- (void) sprintf(buf+strlen(buf), fmt, a1, a2, a3);
+#ifdef HAVE_STDARG_H
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
+
+ *cp++ = 1;
+ (void) sprintf(cp, "%s: ", progname);
+ (void) vsprintf(buf+strlen(buf), fmt, ap);
+ va_end(ap);
(void) write(2, buf, strlen(buf));
syslog(LOG_ERR ,"%s",buf+1);
}
diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c
index 0a8acf666a..815492582f 100644
--- a/src/appl/bsd/login.c
+++ b/src/appl/bsd/login.c
@@ -340,6 +340,8 @@ char * strsave(char *);
typedef krb5_sigtype sigtype;
+sigtype timedout(int);
+
#ifndef HAVE_INITGROUPS
static int initgroups(char* name, gid_t basegid) {
@@ -1044,7 +1046,6 @@ int main(argc, argv)
int fflag, hflag, pflag, rflag, cnt;
int kflag, Kflag, eflag;
int quietlog, passwd_req, ioctlval;
- sigtype timedout();
char *domain, **envinit, *ttyn, *tty;
char tbuf[MAXPATHLEN + 2];
char *ttyname(), *crypt(), *getpass();
@@ -2051,7 +2052,8 @@ void getloginname()
}
sigtype
-timedout()
+timedout(signumber)
+ int signumber;
{
fprintf(stderr, "Login timed out after %d seconds\n", timeout);
exit(0);
diff --git a/src/appl/bsd/setenv.c b/src/appl/bsd/setenv.c
index fad8f594e8..7316edb547 100644
--- a/src/appl/bsd/setenv.c
+++ b/src/appl/bsd/setenv.c
@@ -20,6 +20,12 @@
#include <sys/types.h>
#include <stdio.h>
+#ifdef NEED_SETENV
+extern int setenv(char *, char *, int);
+extern void unsetenv(char *);
+#endif
+
+static char *_findenv(char *, int*);
/*
* setenv --
* Set the value of the environmental variable "name" to be
@@ -34,7 +40,7 @@ setenv(name, value, rewrite)
static int alloced; /* if allocated space before */
register char *C;
int l_value, offset;
- char *malloc(), *realloc(), *_findenv();
+ char *malloc(), *realloc();
if (*value == '=') /* no `=' in value */
++value;
@@ -90,7 +96,6 @@ unsetenv(name)
extern char **environ;
register char **P;
int offset;
- char *_findenv();
while (_findenv(name, &offset)) /* if set multiple times */
for (P = &environ[offset];; ++P)
@@ -116,6 +121,7 @@ unsetenv(name)
/* based on @(#)getenv.c 5.5 (Berkeley) 6/27/88 */
+#ifndef HAVE_GETENV
/*
* getenv --
* Returns ptr to value associated with name, if any, else NULL.
@@ -125,10 +131,10 @@ getenv(name)
char *name;
{
int offset;
- char *_findenv();
return(_findenv(name, &offset));
}
+#endif
/*
* _findenv --
@@ -139,7 +145,7 @@ getenv(name)
*
* This routine *should* be a static; don't use it.
*/
-char *
+static char *
_findenv(name, offset)
register char *name;
int *offset;
diff --git a/src/appl/bsd/v4rcp.c b/src/appl/bsd/v4rcp.c
index 65701b5f05..d27c16c0cc 100644
--- a/src/appl/bsd/v4rcp.c
+++ b/src/appl/bsd/v4rcp.c
@@ -73,6 +73,12 @@ static char sccsid[] = "@(#)rcp.c 5.10 (Berkeley) 9/20/88";
#include <netdb.h>
#endif
#include <errno.h>
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#ifdef KERBEROS
#include <krb.h>
#include <krbports.h>
@@ -81,7 +87,11 @@ static char sccsid[] = "@(#)rcp.c 5.10 (Berkeley) 9/20/88";
void sink(int, char **), source(int, char **),
rsource(char *, struct stat *), usage(void);
/*VARARGS*/
-void error();
+void error (char *fmt, ...)
+#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
+ __attribute__ ((__format__ (__printf__, 1, 2)))
+#endif
+ ;
int response(void);
#if !defined(HAVE_UTIMES)
int utimes();
@@ -321,7 +331,7 @@ int encryptflag = 0;
kstream krem;
int errs;
-krb5_sigtype lostconn();
+krb5_sigtype lostconn(int);
int iamremote, targetshouldbedirectory;
int iamrecursive;
int pflag;
@@ -621,7 +631,7 @@ int response()
char resp, c, rbuf[BUFSIZ], *cp = rbuf;
if (kstream_read (krem, &resp, 1) != 1)
- lostconn();
+ lostconn(0);
switch (resp) {
case 0: /* ok */
@@ -634,7 +644,7 @@ int response()
case 2: /* fatal error, "" */
do {
if (kstream_read (krem, &c, 1) != 1)
- lostconn();
+ lostconn(0);
*cp++ = c;
} while (cp < &rbuf[BUFSIZ] && c != '\n');
if (iamremote == 0)
@@ -648,7 +658,8 @@ int response()
return -1;
}
-krb5_sigtype lostconn()
+krb5_sigtype lostconn(signum)
+ int signum;
{
if (iamremote == 0)
@@ -921,20 +932,34 @@ allocbuf(bp, fd, blksize)
return (bp);
}
+void
+#ifdef HAVE_STDARG_H
+error(char *fmt, ...)
+#else
/*VARARGS1*/
-void error(fmt, a1, a2, a3, a4, a5)
- char *fmt;
- int a1, a2, a3, a4, a5;
+error(fmt, va_alist)
+ char *fmt;
+ va_dcl
+#endif
{
- char buf[BUFSIZ], *cp = buf;
+ va_list ap;
+ char buf[BUFSIZ], *cp = buf;
+
+#ifdef HAVE_STDARG_H
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
- errs++;
- *cp++ = 1;
- (void) sprintf(cp, fmt, a1, a2, a3, a4, a5);
- if (krem)
- (void) kstream_write(krem, buf, strlen(buf));
- if (iamremote == 0)
- (void) write(2, buf+1, strlen(buf+1));
+ errs++;
+ *cp++ = 1;
+ (void) vsprintf(cp, fmt, ap);
+ va_end(ap);
+
+ if (krem)
+ (void) kstream_write(krem, buf, strlen(buf));
+ if (iamremote == 0)
+ (void) write(2, buf+1, strlen(buf+1));
}
void usage()