diff options
author | Luke Leighton <lkcl@samba.org> | 1998-11-23 21:51:05 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-11-23 21:51:05 +0000 |
commit | 4cee58780cb15fe5889b9dd0dc34459512d75062 (patch) | |
tree | 07e0db236cfdb786458451b879333bc1d687cf3c /source3/lib | |
parent | 735926877bb8333a9e862657ea89001bea376b9f (diff) | |
download | samba-4cee58780cb15fe5889b9dd0dc34459512d75062.tar.gz samba-4cee58780cb15fe5889b9dd0dc34459512d75062.tar.bz2 samba-4cee58780cb15fe5889b9dd0dc34459512d75062.zip |
unix instance of group database API
(This used to be commit e76f593b3572ac881f1aa1fb3326d8b7169b0078)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util.c | 17 | ||||
-rw-r--r-- | source3/lib/util_sid.c | 11 |
2 files changed, 22 insertions, 6 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 7247e95c64..ad5dbcf106 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -189,6 +189,18 @@ char *Atoic(char *p, int *n, char *c) return p; } +int* add_num_to_list(uint32 **num, int *count, int val) +{ + (*num) = Realloc((*num), ((*count)+1) * sizeof(uint32)); + if ((*num) == NULL) + { + return NULL; + } + (*num)[(*count)] = val; + (*count)++; + + return (*num); +} /************************************************************************* reads a list of numbers *************************************************************************/ @@ -206,13 +218,10 @@ char *get_numlist(char *p, uint32 **num, int *count) while ((p = Atoic(p, &val, ":,")) != NULL && (*p) != ':') { - (*num) = Realloc((*num), ((*count)+1) * sizeof(uint32)); - if ((*num) == NULL) + if (add_num_to_list(num, count, val) == NULL) { return NULL; } - (*num)[(*count)] = val; - (*count)++; p++; } diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index 9ca3a59ad4..cce360f4c1 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -43,7 +43,7 @@ char *sid_to_string(pstring sidstr_out, DOM_SID *sid) for (i = 0; i < sid->num_auths; i++) { - slprintf(subauth, sizeof(subauth)-1, "-%d", sid->sub_auths[i]); + slprintf(subauth, sizeof(subauth)-1, "-%u", sid->sub_auths[i]); pstrcat(sidstr_out, subauth); } @@ -103,7 +103,9 @@ BOOL string_to_sid(DOM_SID *sidout, char *sidstr) * NOTE - the subauths are in native machine-endian format. They * are converted to little-endian when linearized onto the wire. */ - sid_append_rid(sidout, atoi(tok)); + uint32 rid = (uint32)strtoul(tok, NULL, 10); + DEBUG(50,("string_to_sid: tok: %s rid 0x%x\n", tok, rid)); + sid_append_rid(sidout, rid); } DEBUG(7,("string_to_sid: converted SID %s ok\n", sidstr)); @@ -145,6 +147,11 @@ void sid_copy(DOM_SID *sid1, DOM_SID *sid2) { int i; + for (i = 0; i < 6; i++) + { + sid1->id_auth[i] = sid2->id_auth[i]; + } + for (i = 0; i < sid2->num_auths; i++) { sid1->sub_auths[i] = sid2->sub_auths[i]; |