summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-10-01 18:26:00 +0000
committerGerald Carter <jerry@samba.org>2002-10-01 18:26:00 +0000
commitf2d1f19a66ebaf9b88d23c0faa2412536cc74cda (patch)
tree781120ed548c3f38de9d40795a426de525e7865b /source3/lib
parent2fb5c7c580a3fff3c7d477b65a1c4852af86433b (diff)
downloadsamba-f2d1f19a66ebaf9b88d23c0faa2412536cc74cda.tar.gz
samba-f2d1f19a66ebaf9b88d23c0faa2412536cc74cda.tar.bz2
samba-f2d1f19a66ebaf9b88d23c0faa2412536cc74cda.zip
syncing up with HEAD. Seems to be a lot of differences creeping in
(i ignored the new SAMBA stuff, but the rest of this looks like it should have been merged already). (This used to be commit 3de09e5cf1f667e410ee8b9516a956860ce7290f)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charcnv.c4
-rw-r--r--source3/lib/util_seaccess.c2
-rw-r--r--source3/lib/util_sid.c31
-rw-r--r--source3/lib/util_str.c4
4 files changed, 32 insertions, 9 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index cd8aa4fe55..d0cef52c92 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -522,12 +522,12 @@ int push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src)
*
* @retval The number of bytes occupied by the string in the destination
**/
-int push_utf8_allocate(void **dest, const char *src)
+int push_utf8_allocate(char **dest, const char *src)
{
int src_len = strlen(src)+1;
*dest = NULL;
- return convert_string_allocate(CH_UNIX, CH_UTF8, src, src_len, dest);
+ return convert_string_allocate(CH_UNIX, CH_UTF8, src, src_len, (void **)dest);
}
/****************************************************************************
diff --git a/source3/lib/util_seaccess.c b/source3/lib/util_seaccess.c
index b137023e55..456d7ba9e2 100644
--- a/source3/lib/util_seaccess.c
+++ b/source3/lib/util_seaccess.c
@@ -226,7 +226,7 @@ void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping)
"Access-Checking" document in MSDN.
*****************************************************************************/
-BOOL se_access_check(SEC_DESC *sd, const NT_USER_TOKEN *token,
+BOOL se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
uint32 acc_desired, uint32 *acc_granted,
NTSTATUS *status)
{
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index e9635fc7f8..1439471f64 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -34,6 +34,7 @@ DOM_SID global_sid_World_Domain; /* Everyone domain */
DOM_SID global_sid_World; /* Everyone */
DOM_SID global_sid_Creator_Owner_Domain; /* Creator Owner domain */
DOM_SID global_sid_NT_Authority; /* NT Authority */
+DOM_SID global_sid_System; /* System */
DOM_SID global_sid_NULL; /* NULL sid */
DOM_SID global_sid_Authenticated_Users; /* All authenticated rids */
DOM_SID global_sid_Network; /* Network rids */
@@ -58,6 +59,12 @@ NT_USER_TOKEN anonymous_token = {
anon_sid_array
};
+static DOM_SID system_sid_array[4];
+NT_USER_TOKEN system_token = {
+ 1,
+ system_sid_array
+};
+
/****************************************************************************
Lookup string names for SID types.
****************************************************************************/
@@ -101,6 +108,10 @@ const char *sid_type_lookup(uint32 sid_type)
void generate_wellknown_sids(void)
{
+ static BOOL initialised = False;
+ if (initialised)
+ return;
+
string_to_sid(&global_sid_Builtin, "S-1-5-32");
string_to_sid(&global_sid_Builtin_Administrators, "S-1-5-32-544");
string_to_sid(&global_sid_Builtin_Users, "S-1-5-32-545");
@@ -111,6 +122,7 @@ void generate_wellknown_sids(void)
string_to_sid(&global_sid_Creator_Owner, "S-1-3-0");
string_to_sid(&global_sid_Creator_Group, "S-1-3-1");
string_to_sid(&global_sid_NT_Authority, "S-1-5");
+ string_to_sid(&global_sid_System, "S-1-5-18");
string_to_sid(&global_sid_NULL, "S-1-0-0");
string_to_sid(&global_sid_Authenticated_Users, "S-1-5-11");
string_to_sid(&global_sid_Network, "S-1-5-2");
@@ -120,6 +132,17 @@ void generate_wellknown_sids(void)
sid_copy( &anonymous_token.user_sids[0], &global_sid_World);
sid_copy( &anonymous_token.user_sids[1], &global_sid_Network);
sid_copy( &anonymous_token.user_sids[2], &global_sid_Anonymous);
+
+ /* Create the system token. */
+ sid_copy( &system_token.user_sids[0], &global_sid_System);
+
+ initialised = True;
+}
+
+NT_USER_TOKEN *get_system_token(void)
+{
+ generate_wellknown_sids(); /* The token is initialised here */
+ return &system_token;
}
/**************************************************************************
@@ -347,7 +370,7 @@ void sid_copy(DOM_SID *dst, const DOM_SID *src)
/*****************************************************************
Write a sid out into on-the-wire format.
*****************************************************************/
-BOOL sid_linearize(char *outbuf, size_t len, DOM_SID *sid)
+BOOL sid_linearize(char *outbuf, size_t len, const DOM_SID *sid)
{
size_t i;
@@ -366,7 +389,7 @@ BOOL sid_linearize(char *outbuf, size_t len, DOM_SID *sid)
/*****************************************************************
parse a on-the-wire SID to a DOM_SID
*****************************************************************/
-BOOL sid_parse(char *inbuf, size_t len, DOM_SID *sid)
+BOOL sid_parse(const char *inbuf, size_t len, DOM_SID *sid)
{
int i;
if (len < 8) return False;
@@ -482,7 +505,7 @@ BOOL sid_check_is_in_builtin(const DOM_SID *sid)
Calculates size of a sid.
*****************************************************************/
-size_t sid_size(DOM_SID *sid)
+size_t sid_size(const DOM_SID *sid)
{
if (sid == NULL)
return 0;
@@ -518,7 +541,7 @@ BOOL non_mappable_sid(DOM_SID *sid)
return the binary string representation of a DOM_SID
caller must free
*/
-char *sid_binstring(DOM_SID *sid)
+char *sid_binstring(const DOM_SID *sid)
{
char *buf, *s;
int len = sid_size(sid);
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 1b38db2c94..75338de4d3 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -468,7 +468,7 @@ char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, si
for(i = 0; i < len; i++) {
int val = (src[i] & 0xff);
- if(isupper(val) || islower(val) || isdigit(val) || strchr_m(other_safe_chars, val))
+ if (isupper(val) || islower(val) || isdigit(val) || strchr_m(other_safe_chars, val))
dest[i] = src[i];
else
dest[i] = '_';
@@ -501,7 +501,7 @@ char *StrnCpy(char *dest,const char *src,size_t n)
like strncpy but copies up to the character marker. always null terminates.
returns a pointer to the character marker in the source string (src).
****************************************************************************/
-char *strncpyn(char *dest, const char *src,size_t n, char c)
+char *strncpyn(char *dest, const char *src, size_t n, char c)
{
char *p;
size_t str_len;