summaryrefslogtreecommitdiff
path: root/cygwin_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'cygwin_util.c')
-rw-r--r--cygwin_util.c38
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
26int binary_open(const char *filename, int flags, mode_t mode) 27int 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
31int binary_pipe(int fd[2]) 32int 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
41int check_nt_auth (int pwd_authenticated, uid_t uid) 43int 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
56int check_ntsec (const char *filename) 59int 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 */