diff options
author | Damien Miller <djm@mindrot.org> | 2000-09-24 11:10:13 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-09-24 11:10:13 +1100 |
commit | 72c9a7e958689740cb3449df5732e0956d52ef5b (patch) | |
tree | 70f861946c4e7750bd04cdd57fd7952da1c889fe /cygwin_util.c | |
parent | 62cee00753ef8ce31b322ce6a14318cb974e883d (diff) |
- (djm) Merged cleanup patch from Mark Miller <markm@swoon.net>
- (djm) A bit more cleanup - created cygwin_util.h
Diffstat (limited to 'cygwin_util.c')
-rw-r--r-- | cygwin_util.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/cygwin_util.c b/cygwin_util.c index 88748c4fb..b540ebe1a 100644 --- a/cygwin_util.c +++ b/cygwin_util.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include "config.h" | 16 | #include "config.h" |
17 | 17 | ||
18 | #ifdef HAVE_CYGWIN | 18 | #ifdef HAVE_CYGWIN |
19 | |||
19 | #include <fcntl.h> | 20 | #include <fcntl.h> |
20 | #include <io.h> | 21 | #include <io.h> |
21 | #include <stdlib.h> | 22 | #include <stdlib.h> |
@@ -25,35 +26,37 @@ | |||
25 | 26 | ||
26 | int binary_open(const char *filename, int flags, mode_t mode) | 27 | int binary_open(const char *filename, int flags, mode_t mode) |
27 | { | 28 | { |
28 | return open(filename, flags | O_BINARY, mode); | 29 | return open(filename, flags | O_BINARY, mode); |
29 | } | 30 | } |
30 | 31 | ||
31 | int binary_pipe(int fd[2]) | 32 | int binary_pipe(int fd[2]) |
32 | { | 33 | { |
33 | int ret = pipe(fd); | 34 | int ret = pipe(fd); |
34 | if (!ret) { | 35 | |
35 | setmode (fd[0], O_BINARY); | 36 | if (!ret) { |
36 | setmode (fd[1], O_BINARY); | 37 | setmode (fd[0], O_BINARY); |
37 | } | 38 | setmode (fd[1], O_BINARY); |
38 | return ret; | 39 | } |
40 | return ret; | ||
39 | } | 41 | } |
40 | 42 | ||
41 | int check_nt_auth (int pwd_authenticated, uid_t uid) | 43 | int check_nt_auth(int pwd_authenticated, uid_t uid) |
42 | { | 44 | { |
43 | /* | 45 | /* |
44 | * The only authentication which is able to change the user | 46 | * The only authentication which is able to change the user |
45 | * context on NT systems is the password authentication. So | 47 | * context on NT systems is the password authentication. So |
46 | * we deny all requsts for changing the user context if another | 48 | * we deny all requsts for changing the user context if another |
47 | * authentication method is used. | 49 | * authentication method is used. |
48 | * This may change in future when a special openssh | 50 | * This may change in future when a special openssh |
49 | * subauthentication package is available. | 51 | * subauthentication package is available. |
50 | */ | 52 | */ |
51 | if (is_winnt && !pwd_authenticated && geteuid() != uid) | 53 | if (is_winnt && !pwd_authenticated && geteuid() != uid) |
52 | return 0; | 54 | return 0; |
55 | |||
53 | return 1; | 56 | return 1; |
54 | } | 57 | } |
55 | 58 | ||
56 | int check_ntsec (const char *filename) | 59 | int check_ntsec(const char *filename) |
57 | { | 60 | { |
58 | char *cygwin; | 61 | char *cygwin; |
59 | int allow_ntea = 0; | 62 | int allow_ntea = 0; |
@@ -98,4 +101,5 @@ int check_ntsec (const char *filename) | |||
98 | 101 | ||
99 | return 0; | 102 | return 0; |
100 | } | 103 | } |
101 | #endif | 104 | |
105 | #endif /* HAVE_CYGWIN */ | ||