AC_PROG_INSTALL
AC_HAVE_LIBRARY(socket)
AC_HAVE_LIBRARY(nsl)
+AC_FUNC_CHECK(strsave,AC_DEFINE(HAS_STRSAVE))
AC_FUNC_CHECK(utimes,AC_DEFINE(HAS_UTIMES))
AC_FUNC_CHECK(getutent,AC_DEFINE(HAVE_GETUTENT))
AC_FUNC_CHECK(setreuid,AC_DEFINE(HAVE_SETREUID))
AC_FUNC_CHECK(getdtablesize,AC_DEFINE(HAVE_GETDTABLESIZE))
AC_FUNC_CHECK(initgroups,AC_DEFINE(HAVE_INITGROUPS))
AC_FUNC_CHECK(setpriority,AC_DEFINE(HAVE_SETPRIORITY))
+AC_FUNC_CHECK(setreuid,AC_DEFINE(HAVE_SETREUID))
+AC_FUNC_CHECK(setresuid,AC_DEFINE(HAVE_SETRESUID))
AC_FUNC_CHECK(sigprocmask,
AC_COMPILE_CHECK([sigset_t],
[#include <signal.h>],
#endif /* !(defined(ultrix) || defined(sun)) */
perror(hp->h_name);
#ifdef POSIX_SIGNALS
- sigprocmask(SIG_SETMASK, &oldmask, (sigset_t*)0);
+ sigprocmask(SIG_SETMASK, &oldmask, (sigset_t*)0);
#else
#ifndef sgi
sigsetmask(oldmask);
+#ifndef HAVE_STRSAVE
/* Strsave was a routine in the version 4 krb library: we put it here
for compatablilty with version 5 krb library, since kcmd.o is linked
into all programs. */
return(ret);
}
-
+#endif
#ifdef SYSV
/*
- * $Source$
- * $Header$
+ * appl/bsd/krcp.c
*/
-#ifndef lint
-static char *rcsid_rcp_c = "$Header$";
-#endif /* lint */
-
/*
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
#include <errno.h>
#include <string.h>
+#ifdef HAVE_SETRESUID
+#ifndef HAVE_SETREUID
+#define setreuid(r,e) setresuid(r,e,-1)
+#endif
+#endif
#ifndef roundup
#define roundup(x,y) ((((x)+(y)-1)/(y))*(y))
#endif
krb5_keyblock *session_key; /* static key for session */
void try_normal();
-char **save_argv(), *strsave();
+char **save_argv();
+#ifndef HAVE_STRSAVE
+char *strsave();
+#endif
int des_write(), des_read();
void send_auth(), answer_auth();
int encryptflag = 0;
if (encryptflag)
send_auth();
}
+#ifdef HAVE_SETREUID
(void) setreuid(0, userid);
sink(1, argv+argc-1);
(void) setreuid(userid, 0);
+#else
+ (void) setuid(0);
+ if(seteuid(userid)) {
+ perror("rcp seteuid user"); errs++; exit(errs);
+ }
+ sink(1, argv+argc-1);
+ if(seteuid(0)) {
+ perror("rcp seteuid 0"); errs++; exit(errs);
+ }
+#endif
#else
rem = rcmd(&host, port, pwd->pw_name, suser,
buf, 0);
if (rem < 0)
continue;
+#ifdef HAVE_SETREUID
(void) setreuid(0, userid);
sink(1, argv+argc-1);
(void) setreuid(userid, 0);
+#else
+ (void) setuid(0);
+ if(seteuid(userid)) {
+ perror("rcp seteuid user"); errs++; exit(errs);
+ }
+ sink(1, argv+argc-1);
+ if(seteuid(0)) {
+ perror("rcp seteuid 0"); errs++; exit(errs);
+ }
+#endif
#endif /* KERBEROS */
(void) close(rem);
rem = -1;
int sig;
krb5_sigtype (*act)();
{
+#ifdef POSIX_SIGNALS
+ sigset_t omask, igmask;
+ sigemptyset(&igmask);
+ sigaddset(&igmask, sig);
+ sigprocmask(SIG_BLOCK, &igmask, &omask);
+#else
#ifdef sgi
int omask = sigignore(sigmask(sig));
#else
int omask = sigblock(sigmask(sig));
#endif
+#endif /* POSIX_SIGNALS */
if (signal(sig, act) == SIG_IGN)
(void) signal(sig, SIG_IGN);
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &omask, (sigset_t*)0);
+#else
#ifndef sgi
(void) sigsetmask(omask);
#endif
+#endif
}
#endif /* KERBEROS */
#endif /* !RLOGIN_PROGRAM */
+#ifndef POSIX_SIGNALS
#define mask(s) (1 << ((s) - 1))
+#endif /* POSIX_SIGNALS */
main(argc, argv0)
int argc;
int readfrom, ready;
int one = 1;
struct servent *sp;
+#ifdef POSIX_SIGNALS
+ sigset_t omask, igmask;
+#else
int omask;
+#endif
#ifdef KERBEROS
krb5_flags authopts;
krb5_error_code status;
perror("setsockopt (stderr)");
}
(void) setuid(getuid());
+#ifdef POSIX_SIGNALS
+ sigemptyset(&igmask);
+ sigaddset(&igmask, SIGINT);
+ sigaddset(&igmask, SIGQUIT);
+ sigaddset(&igmask, SIGTERM);
+ sigprocmask(SIG_BLOCK, &igmask, &omask);
+#else
#ifdef sgi
omask = sigignore(mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM));
#else
omask = sigblock(mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM));
#endif
+#endif /* POSIX_SIGNALS */
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, sendsig);
if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
(void) shutdown(rem, 1);
exit(0);
}
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &omask, (sigset_t*)0);
+#else
#ifndef sgi
sigsetmask(omask);
#endif
+#endif /* POSIX_SIGNALS */
readfrom = (1<<rfd2) | (1<<rem);
do {
ready = readfrom;
#include <sys/id.h>
#endif
-#ifndef HAVE_GETDTABLESIZE
-#include <sys/resource.h>
-int getdtablesize() {
- struct rlimit rl;
- getrlimit(RLIMIT_NOFILE, &rl);
- return rl.rlim_cur;
-}
-#endif
-
#if defined(_AIX)
#define PRIO_OFFSET 20
#else
#endif /* KRB4 */
+#ifndef HAVE_STRSAVE
+/* Strsave was a routine in the version 4 krb library: we put it here
+ for compatablilty with version 5 krb library, since kcmd.o is linked
+ into all programs. */
+
+char *
+ strsave(sp)
+char *sp;
+{
+ register char *ret;
+
+ if((ret = (char *) malloc((unsigned) strlen(sp)+1)) == NULL) {
+ fprintf(stderr, "no memory for saving args\n");
+ exit(1);
+ }
+ (void) strcpy(ret,sp);
+ return(ret);
+}
+
+#endif
+
#ifdef _IBMR2
update_ref_count(int adj)
{