r->proc = proc;
r->request_buffer = malloc(len * BYTES_PER_XDR_UNIT);
- if (r->request_buffer == NULL)
- {
- free(r);
- return NULL;
- }
-
memcpy(r->request_buffer, buf, len * BYTES_PER_XDR_UNIT);
r->request_buffer_len = len;
if (!xdr_int(inxdr, &nkeys)) return NULL;
l = (ni_proplist *)malloc(sizeof(ni_proplist));
- if (l == NULL) return NULL;
-
NI_INIT(l);
l->ni_proplist_len = nkeys;
if (nkeys > 0)
{
l->ni_proplist_val = (ni_property *)calloc(nkeys, sizeof(ni_property));
- if (l->ni_proplist_val == NULL)
- {
- free(l);
- return NULL;
- }
}
for (i = 0; i < nkeys; i++)
if (nvals > 0)
{
l->ni_proplist_val[i].nip_val.ni_namelist_val = (ni_name *)calloc(nvals, sizeof(ni_name));
- if (l->ni_proplist_val[i].nip_val.ni_namelist_val == NULL)
- {
- ni_proplist_free(l);
- return NULL;
- }
}
for (j = 0; j < nvals; j++)
}
*out = (ni_proplist **)malloc(n * sizeof(ni_proplist *));
- if (out == NULL)
- {
- xdr_destroy(&inxdr);
- return 0;
- }
for (i = 0; i < n; i++)
{
if (fmt[0] != 'k') return NULL;
l = (ni_proplist *)malloc(sizeof(ni_proplist));
- if (l == NULL) return NULL;
-
NI_INIT(l);
na = 0;
if (cat != NULL)
{
l->ni_proplist_val = (ni_property *)malloc(sizeof(ni_property));
- if (l->ni_proplist_val == NULL)
- {
- free(l);
- return NULL;
- }
-
p = &(l->ni_proplist_val[0]);
arg = "_lookup_category";
p->nip_name = strdup(arg);
- if (p->nip_name == NULL)
- {
- ni_proplist_free(l);
- return NULL;
- }
-
p->nip_val.ni_namelist_len = 1;
p->nip_val.ni_namelist_val = (ni_name *)malloc(sizeof(ni_name));
- if (p->nip_val.ni_namelist_val == NULL)
- {
- ni_proplist_free(l);
- return NULL;
- }
-
p->nip_val.ni_namelist_val[0] = strdup(cat);
- if (p->nip_val.ni_namelist_val[0] == NULL)
- {
- ni_proplist_free(l);
- return NULL;
- }
-
+
l->ni_proplist_len++;
x++;
}
arg = va_arg(ap, char *);
if (*f == 'k')
{
- l->ni_proplist_val = (ni_property *)reallocf(l->ni_proplist_val, (l->ni_proplist_len + 1) * sizeof(ni_property));
- if (l->ni_proplist_val == NULL)
- {
- ni_proplist_free(l);
- return NULL;
- }
-
+ l->ni_proplist_val = (ni_property *)realloc(l->ni_proplist_val, (l->ni_proplist_len + 1) * sizeof(ni_property));
+
p = &(l->ni_proplist_val[l->ni_proplist_len]);
p->nip_name = strdup(arg);
- if (p->nip_name == NULL)
- {
- ni_proplist_free(l);
- return NULL;
- }
-
p->nip_val.ni_namelist_len = 0;
p->nip_val.ni_namelist_val = NULL;
}
else
{
- p->nip_val.ni_namelist_val = (ni_name *)reallocf(p->nip_val.ni_namelist_val, (p->nip_val.ni_namelist_len + 1) * sizeof(ni_name));
- }
-
- if (p->nip_val.ni_namelist_val == NULL)
- {
- ni_proplist_free(l);
- return NULL;
+ p->nip_val.ni_namelist_val = (ni_name *)realloc(p->nip_val.ni_namelist_val, (p->nip_val.ni_namelist_len + 1) * sizeof(ni_name));
}
-
p->nip_val.ni_namelist_val[p->nip_val.ni_namelist_len] = strdup(arg);
- if (p->nip_val.ni_namelist_val[p->nip_val.ni_namelist_len] == NULL)
- {
- ni_proplist_free(l);
- return NULL;
- }
-
p->nip_val.ni_namelist_len++;
}
}
if (addme == 1)
{
- a->nip_val.ni_namelist_val = (ni_name *)reallocf(a->nip_val.ni_namelist_val, (a->nip_val.ni_namelist_len + 1) * sizeof(ni_name));
- if (a->nip_val.ni_namelist_val == NULL) return;
-
+ a->nip_val.ni_namelist_val = (ni_name *)realloc(a->nip_val.ni_namelist_val, (a->nip_val.ni_namelist_len + 1) * sizeof(ni_name));
a->nip_val.ni_namelist_val[a->nip_val.ni_namelist_len] = strdup(b->nip_val.ni_namelist_val[j]);
- if (a->nip_val.ni_namelist_val[a->nip_val.ni_namelist_len] == NULL)
- {
- free(a->nip_val.ni_namelist_val);
- a->nip_val.ni_namelist_val = NULL;
- return;
- }
-
a->nip_val.ni_namelist_len++;
}
}
}
if (addme == 1)
{
- a->ni_proplist_val = (ni_property *)reallocf(a->ni_proplist_val, (a->ni_proplist_len + 1) * sizeof(ni_property));
- if (a->ni_proplist_val == NULL) return;
-
+ a->ni_proplist_val = (ni_property *)realloc(a->ni_proplist_val, (a->ni_proplist_len + 1) * sizeof(ni_property));
a->ni_proplist_val[a->ni_proplist_len].nip_name = strdup(b->ni_proplist_val[wb].nip_name);
- if (a->ni_proplist_val[a->ni_proplist_len].nip_name == NULL)
- {
- free(a->ni_proplist_val);
- a->ni_proplist_val = NULL;
- return NULL;
- }
-
a->ni_proplist_val[a->ni_proplist_len].nip_val.ni_namelist_len = 0;
a->ni_proplist_val[a->ni_proplist_len].nip_val.ni_namelist_val = NULL;
a->ni_proplist_len++;
if (libinfo_data != NULL) return libinfo_data;
libinfo_data = (struct _lu_data_s *)calloc(1, sizeof(struct _lu_data_s));
- if (libinfo_data == NULL) return NULL;
pthread_setspecific(_info_key, libinfo_data);
return libinfo_data;
unsigned int i, n;
libinfo_data = _lu_data_get();
- if (libinfo_data == NULL) return NULL;
for (i = 0; i < libinfo_data->icount; i++)
{
}
else
{
- libinfo_data->ikey = (unsigned int *)reallocf(libinfo_data->ikey, n * sizeof(unsigned int));
- libinfo_data->idata = (void **)reallocf(libinfo_data->idata, n * sizeof(void *));
- libinfo_data->idata_destructor = (void (**)(void *))reallocf(libinfo_data->idata_destructor, n * sizeof(void (*)(void *)));
- }
-
- if ((libinfo_data->ikey == NULL) || (libinfo_data->idata == NULL) || (libinfo_data->idata_destructor == NULL))
- {
- if (libinfo_data->ikey != NULL) free(libinfo_data->ikey);
- if (libinfo_data->idata != NULL) free(libinfo_data->idata);
- if (libinfo_data->idata_destructor != NULL) free(libinfo_data->idata_destructor);
- return NULL;
+ libinfo_data->ikey = (unsigned int *)realloc(libinfo_data->ikey, n * sizeof(unsigned int));
+ libinfo_data->idata = (void **)realloc(libinfo_data->idata, n * sizeof(void *));
+ libinfo_data->idata_destructor = (void (**)(void *))realloc(libinfo_data->idata_destructor, n * sizeof(void (*)(void *)));
}
libinfo_data->ikey[i] = key;
unsigned int i;
libinfo_data = _lu_data_get();
- if (libinfo_data == NULL) return;
i = _lu_data_index(key, libinfo_data);
if (i == (unsigned int)-1) return;
unsigned int i;
libinfo_data = _lu_data_get();
- if (libinfo_data == NULL) return NULL;
i = _lu_data_index(key, libinfo_data);
if (i == (unsigned int)-1) return NULL;
*count = len;
x = (char **)calloc(len + 1, sizeof(char *));
- if (x == NULL) return -1;
-
*val = x;
for (i = 0; i < len; i++)
struct kauth_identity_extlookup request;
int result = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_UID | KAUTH_EXTLOOKUP_WANT_UGUID;
request.el_uid = id;
result = _mbr_DoMembershipCall(GetServerPort(), &request);
kern_return_t result;
int error = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_GID | KAUTH_EXTLOOKUP_WANT_GGUID;
request.el_gid = id;
result = _mbr_DoMembershipCall(GetServerPort(), &request);
kern_return_t result;
int error = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_UGUID | KAUTH_EXTLOOKUP_VALID_GGUID |
KAUTH_EXTLOOKUP_WANT_UID | KAUTH_EXTLOOKUP_WANT_GID;
memcpy(&request.el_uguid, uu, sizeof(guid_t));
kern_return_t result;
int error = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_GSID | KAUTH_EXTLOOKUP_WANT_GGUID;
memset(&request.el_gsid, 0, sizeof(ntsid_t));
memcpy(&request.el_gsid, sid, KAUTH_NTSID_SIZE(sid));
kern_return_t result;
int error = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_GGUID | KAUTH_EXTLOOKUP_WANT_GSID;
memcpy(&request.el_gguid, uu, sizeof(guid_t));
result = _mbr_DoMembershipCall(GetServerPort(), &request);
kern_return_t result;
int error = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_UGUID | KAUTH_EXTLOOKUP_VALID_GGUID |
KAUTH_EXTLOOKUP_WANT_MEMBERSHIP;
memcpy(&request.el_uguid, user, sizeof(guid_t));
kern_return_t result;
int error = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_UGUID | KAUTH_EXTLOOKUP_VALID_GGUID |
KAUTH_EXTLOOKUP_WANT_MEMBERSHIP | (1<<15);
memcpy(&request.el_uguid, user, sizeof(guid_t));
kern_return_t result;
int error = 0;
- request.el_seqno = 1; // used as byte order field
request.el_flags = KAUTH_EXTLOOKUP_VALID_UGUID | KAUTH_EXTLOOKUP_VALID_GID |
KAUTH_EXTLOOKUP_WANT_MEMBERSHIP;
memcpy(&request.el_uguid, user, sizeof(guid_t));