summaryrefslogtreecommitdiff
path: root/sshconnect.h
diff options
context:
space:
mode:
authormouring <mouring>2002-06-11 16:37:51 +0000
committermouring <mouring>2002-06-11 16:37:51 +0000
commit65944d984ed584f5282ad869d3916640236018d8 (patch)
treebcb9111f415aa46bceb31525f1970bfde70820bb /sshconnect.h
parent1058ba0ca7f400281b80f27e5c6101fce4756eb0 (diff)
downloadopenssh-65944d984ed584f5282ad869d3916640236018d8.tar.gz
- markus@cvs.openbsd.org 2002/06/11 04:14:26
[ssh.c sshconnect.c sshconnect.h] no longer use uidswap.[ch] from the ssh client run less code with euid==0 if ssh is installed setuid root just switch the euid, don't switch the complete set of groups (this is only needed by sshd). ok provos@
Diffstat (limited to 'sshconnect.h')
-rw-r--r--sshconnect.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/sshconnect.h b/sshconnect.h
index aeb2e51a..48148833 100644
--- a/sshconnect.h
+++ b/sshconnect.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.h,v 1.15 2002/06/09 13:32:01 markus Exp $ */
+/* $OpenBSD: sshconnect.h,v 1.16 2002/06/11 04:14:26 markus Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -35,7 +35,7 @@ struct Sensitive {
int
ssh_connect(const char *, struct sockaddr_storage *, u_short, int, int,
- int, struct passwd *, const char *);
+ int, const char *);
void
ssh_login(Sensitive *, const char *, struct sockaddr *, struct passwd *);
@@ -50,4 +50,20 @@ void ssh_userauth2(const char *, const char *, char *, Sensitive *);
void ssh_put_password(char *);
+
+/*
+ * Macros to raise/lower permissions.
+ */
+#define PRIV_START do { \
+ int save_errno = errno; \
+ (void)seteuid(original_effective_uid); \
+ errno = save_errno; \
+} while (0)
+
+#define PRIV_END do { \
+ int save_errno = errno; \
+ (void)seteuid(original_real_uid); \
+ errno = save_errno; \
+} while (0)
+
#endif