s3-talloc Change TALLOC_ARRAY() to talloc_array()
[samba.git] / source3 / groupdb / mapping_tdb.c
index 2634552127740a568b52beaffd93594d3a0c63d4..cf8857cda541990cff878745933d5ea41b361999 100644 (file)
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "passdb.h"
 #include "groupdb/mapping.h"
 #include "dbwrap.h"
+#include "util_tdb.h"
 #include "../libcli/security/security.h"
 
 static struct db_context *db; /* used for driver files */
@@ -143,7 +145,7 @@ static bool add_mapping_entry(GROUP_MAP *map, int flag)
        len = tdb_pack(NULL, 0, "ddff",
                map->gid, map->sid_name_use, map->nt_name, map->comment);
 
-       buf = TALLOC_ARRAY(key, char, len);
+       buf = talloc_array(key, char, len);
        if (!buf) {
                TALLOC_FREE(key);
                return false;
@@ -847,7 +849,7 @@ static int convert_ldb_record(TDB_CONTEXT *ltdb, TDB_DATA key,
                p += len + 1;
 
                num_vals = pull_uint32(p, 0);
-               if (StrCaseCmp(name, "member") == 0) {
+               if (strcasecmp_m(name, "member") == 0) {
                        num_mem = num_vals;
                        members = talloc_array(tmp_ctx, struct dom_sid, num_mem);
                        if (members == NULL) {
@@ -880,30 +882,30 @@ static int convert_ldb_record(TDB_CONTEXT *ltdb, TDB_DATA key,
 
                        /* we ignore unknown or uninteresting attributes
                         * (objectclass, etc.) */
-                       if (StrCaseCmp(name, "gidNumber") == 0) {
+                       if (strcasecmp_m(name, "gidNumber") == 0) {
                                map.gid = strtoul(val, &q, 10);
                                if (*q) {
                                        errno = EIO;
                                        goto failed;
                                }
-                       } else if (StrCaseCmp(name, "sid") == 0) {
+                       } else if (strcasecmp_m(name, "sid") == 0) {
                                if (!string_to_sid(&map.sid, val)) {
                                        errno = EIO;
                                        goto failed;
                                }
-                       } else if (StrCaseCmp(name, "sidNameUse") == 0) {
+                       } else if (strcasecmp_m(name, "sidNameUse") == 0) {
                                map.sid_name_use = strtoul(val, &q, 10);
                                if (*q) {
                                        errno = EIO;
                                        goto failed;
                                }
-                       } else if (StrCaseCmp(name, "ntname") == 0) {
+                       } else if (strcasecmp_m(name, "ntname") == 0) {
                                strlcpy(map.nt_name, val,
-                                       sizeof(map.nt_name) -1);
-                       } else if (StrCaseCmp(name, "comment") == 0) {
+                                       sizeof(map.nt_name));
+                       } else if (strcasecmp_m(name, "comment") == 0) {
                                strlcpy(map.comment, val,
-                                       sizeof(map.comment) -1);
-                       } else if (StrCaseCmp(name, "member") == 0) {
+                                       sizeof(map.comment));
+                       } else if (strcasecmp_m(name, "member") == 0) {
                                if (!string_to_sid(&members[j], val)) {
                                        errno = EIO;
                                        goto failed;