summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-cygwin_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/bsd-cygwin_util.c')
-rw-r--r--openbsd-compat/bsd-cygwin_util.c40
1 files changed, 1 insertions, 39 deletions
diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c
index dbf8176b6..38be7e350 100644
--- a/openbsd-compat/bsd-cygwin_util.c
+++ b/openbsd-compat/bsd-cygwin_util.c
@@ -175,45 +175,7 @@ check_nt_auth(int pwd_authenticated, struct passwd *pw)
175int 175int
176check_ntsec(const char *filename) 176check_ntsec(const char *filename)
177{ 177{
178 char *cygwin; 178 return (pathconf(filename, _PC_POSIX_PERMISSIONS));
179 int allow_ntea = 0, allow_ntsec = 0;
180 struct statfs fsstat;
181
182 /* Windows 95/98/ME don't support file system security at all. */
183 if (!is_winnt)
184 return (0);
185
186 /* Evaluate current CYGWIN settings. */
187 cygwin = getenv("CYGWIN");
188 allow_ntea = ntea_on(cygwin);
189 allow_ntsec = ntsec_on(cygwin) ||
190 (has_capability(HAS_NTSEC_BY_DEFAULT) && !ntsec_off(cygwin));
191
192 /*
193 * `ntea' is an emulation of POSIX attributes. It doesn't support
194 * real file level security as ntsec on NTFS file systems does
195 * but it supports FAT filesystems. `ntea' is minimum requirement
196 * for security checks.
197 */
198 if (allow_ntea)
199 return (1);
200
201 /*
202 * Retrieve file system flags. In Cygwin, file system flags are
203 * copied to f_type which has no meaning in Win32 itself.
204 */
205 if (statfs(filename, &fsstat))
206 return (1);
207
208 /*
209 * Only file systems supporting ACLs are able to set permissions.
210 * `ntsec' is the setting in Cygwin which switches using of NTFS
211 * ACLs to support POSIX permissions on files.
212 */
213 if (fsstat.f_type & FS_PERSISTENT_ACLS)
214 return (allow_ntsec);
215
216 return (0);
217} 179}
218 180
219void 181void