aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/security.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-04-20 13:02:32 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-04-20 13:02:32 +0000
commitc0d1968a18c75ffb160c840c474b9b1e095cd541 (patch)
tree99ad46ce44b67c9c6c175bb8b61ca46e18d57336 /winsup/cygwin/security.h
parent125261f738b1ae42ac89c50d06478b6955be1d73 (diff)
downloadnewlib-c0d1968a18c75ffb160c840c474b9b1e095cd541.zip
newlib-c0d1968a18c75ffb160c840c474b9b1e095cd541.tar.gz
newlib-c0d1968a18c75ffb160c840c474b9b1e095cd541.tar.bz2
* Makefile.in: Add object files `sec_helper.cc' and `sec_acl.cc'.
* security.cc: Swap out several functions. * sec_acl.cc: New file. Move Sun compatibel ACL functions from `security.cc' to here. * sec_helper.cc: New file. Move security helper functions from `security.cc' to here. * security.h: Changed to accomodate the above changes. * grp.cc: Replace `group_in_memory_p' by `group_state'. Eliminate group_sem throughout. (enum grp_state): New enumeration type. (read_etc_group): Make race safe. * security.cc: Eliminate group_sem throughout.
Diffstat (limited to 'winsup/cygwin/security.h')
-rw-r--r--winsup/cygwin/security.h43
1 files changed, 32 insertions, 11 deletions
diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h
index bd1b3d8..b83e310 100644
--- a/winsup/cygwin/security.h
+++ b/winsup/cygwin/security.h
@@ -1,6 +1,6 @@
/* security.h: security declarations
- Copyright 2000 Red Hat, Inc.
+ Copyright 2000, 2001 Red Hat, Inc.
This file is part of Cygwin.
@@ -8,30 +8,51 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#define DONT_INHERIT (0)
+#define INHERIT_ALL (CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)
+#define INHERIT_ONLY (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)
+
+extern BOOL allow_ntsec;
+extern BOOL allow_smbntsec;
+
/* File manipulation */
int __stdcall set_process_privileges ();
int __stdcall get_file_attribute (int, const char *, int *,
uid_t * = NULL, gid_t * = NULL);
int __stdcall set_file_attribute (int, const char *, int);
int __stdcall set_file_attribute (int, const char *, uid_t, gid_t, int, const char *);
-extern BOOL allow_ntsec;
-extern BOOL allow_smbntsec;
-
+LONG __stdcall read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size);
+LONG __stdcall write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size);
+BOOL __stdcall add_access_allowed_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit);
+BOOL __stdcall add_access_denied_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit);
+
+
+/* sec_helper.cc: Security helper functions. */
+char *__stdcall convert_sid_to_string_sid (PSID psid, char *sid_str);
+PSID __stdcall convert_string_sid_to_sid (PSID psid, const char *sid_str);
+PSID __stdcall get_sid (PSID psid, DWORD s, DWORD cnt, DWORD *r);
+BOOL __stdcall get_pw_sid (PSID sid, struct passwd *pw);
+BOOL __stdcall get_gr_sid (PSID sid, struct group *gr);
+PSID __stdcall get_admin_sid ();
+PSID __stdcall get_system_sid ();
+PSID __stdcall get_creator_owner_sid ();
+PSID __stdcall get_world_sid ();
+int get_id_from_sid (PSID psid, BOOL search_grp, int *type);
+int __stdcall get_id_from_sid (PSID psid, BOOL search_grp);
+BOOL __stdcall legal_sid_type (SID_NAME_USE type);
+BOOL __stdcall is_grp_member (uid_t uid, gid_t gid);
/* `lookup_name' should be called instead of LookupAccountName.
* logsrv may be NULL, in this case only the local system is used for lookup.
* The buffer for ret_sid (40 Bytes) has to be allocated by the caller! */
BOOL __stdcall lookup_name (const char *, const char *, PSID);
-char *__stdcall convert_sid_to_string_sid (PSID, char *);
-PSID __stdcall convert_string_sid_to_sid (PSID, const char *);
-BOOL __stdcall get_pw_sid (PSID, struct passwd *);
-/* Retrieve a security descriptor that allows all access */
-SECURITY_DESCRIPTOR *__stdcall get_null_sd (void);
-
-int __stdcall get_id_from_sid (PSID, BOOL);
extern inline int get_uid_from_sid (PSID psid) { return get_id_from_sid (psid, FALSE);}
extern inline int get_gid_from_sid (PSID psid) { return get_id_from_sid (psid, TRUE); }
+/* shared.cc: */
+/* Retrieve a security descriptor that allows all access */
+SECURITY_DESCRIPTOR *__stdcall get_null_sd (void);
+
/* Various types of security attributes for use in Create* functions. */
extern SECURITY_ATTRIBUTES sec_none, sec_none_nih, sec_all, sec_all_nih;
extern SECURITY_ATTRIBUTES *__stdcall sec_user (PVOID sa_buf, PSID sid2 = NULL, BOOL inherit = TRUE);