cred->principal = NULL;
if (princ != NULL) {
+ char *s = NULL;
char *p = NULL;
- cred->principal = talloc_strdup(cred, princ);
- if (cred->principal == NULL) {
+ s = talloc_strdup(cred, princ);
+ if (s == NULL) {
return NULL;
}
- p = strchr(cred->principal, '@');
+ p = strchr(s, '@');
if (p != NULL) {
p += 1;
*p = toupper(p[0]);
}
}
+ cred->principal = s;
}
if (cred->principal_obtained == CRED_CALLBACK) {
/* If `val = NULL` is passed, principal is reset */
cred->principal = NULL;
if (val != NULL) {
- char *p = strchr(val, '@');
- if (p != NULL) {
+ const char *cp = NULL;
+ char *s = NULL;
+ char *p = NULL;
+
+ cp = strchr(val, '@');
+ if (cp != NULL) {
/* For realm names, only ASCII is allowed */
- if (!str_is_ascii(p + 1)) {
+ if (!str_is_ascii(cp + 1)) {
return false;
}
}
- cred->principal = talloc_strdup(cred, val);
- if (cred->principal == NULL) {
+ s = talloc_strdup(cred, val);
+ if (s == NULL) {
return false;
}
- p = strchr(cred->principal, '@');
+ p = strchr(s, '@');
if (p != NULL) {
p += 1;
*p = toupper(p[0]);
}
}
+ cred->principal = s;
}
cred->principal_obtained = obtained;
cli_credentials_invalidate_ccache(cred, cred->principal_obtained);
}
for (i=0; options != NULL; i++) {
- const char *name = options;
+ char *option = options;
+ const char *name = NULL;
const char *value = NULL;
- p = strchr(options, ',');
+ p = strchr(option, ',');
if (p != NULL) {
*p = '\0';
options = p+1;
options = NULL;
}
- p = strchr(name, '=');
+ name = option;
+ p = strchr(option, '=');
if (p != NULL) {
*p = '\0';
value = p + 1;
*/
static void parse_ip(struct tagged_ip *ip, const char *str)
{
- char *s = strchr(str, ':');
- if (!s) {
+ const char *c = NULL;
+ char *s = NULL;
+
+ c = strchr(str, ':');
+ if (c == NULL) {
fstrcpy(ip->tag, "*");
ip->ip = interpret_addr2(str);
return;
}
- ip->ip = interpret_addr2(s+1);
+ ip->ip = interpret_addr2(c+1);
fstrcpy(ip->tag, str);
s = strchr(ip->tag, ':');
if (s) {
****************************************************************************/
#define strip_driver_path(_mem_ctx, _element) do { \
+ const char *_p = NULL; \
if (_element && ((_p = strrchr((_element), '\\')) != NULL)) { \
(_element) = talloc_asprintf((_mem_ctx), "%s", _p+1); \
W_ERROR_HAVE_NO_MEMORY((_element)); \
const char *short_architecture;
int i, cversion;
WERROR err;
- char *_p;
if (!*driver_path || !*data_file) {
return WERR_INVALID_PARAMETER;
/* returns back the forest DNS name */
const char *samdb_forest_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
{
- const char *forest_name = ldb_dn_canonical_string(mem_ctx,
- ldb_get_root_basedn(ldb));
- char *p;
+ char *forest_name = NULL;
+ char *p = NULL;
+ forest_name = ldb_dn_canonical_string(mem_ctx,
+ ldb_get_root_basedn(ldb));
if (forest_name == NULL) {
return NULL;
}
/* returns back the default domain DNS name */
const char *samdb_default_domain_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
{
- const char *domain_name = ldb_dn_canonical_string(mem_ctx,
- ldb_get_default_basedn(ldb));
+ char *domain_name = NULL;
char *p;
+ domain_name = ldb_dn_canonical_string(mem_ctx,
+ ldb_get_default_basedn(ldb));
if (domain_name == NULL) {
return NULL;
}
struct ldb_message **result_res = NULL;
struct ldb_message *result = NULL;
int i;
- char *p;
+ char *s = NULL;
+ char *p = NULL;
struct ldb_dn *partitions_basedn = samdb_partitions_dn(sam_ctx, mem_ctx);
const char * const _domain_attrs_1779[] = { "ncName", "dnsRoot", NULL};
}
}
- info1->dns_domain_name = ldb_dn_canonical_string(mem_ctx, result->dn);
- W_ERROR_HAVE_NO_MEMORY(info1->dns_domain_name);
- p = strchr(info1->dns_domain_name, '/');
+ s = ldb_dn_canonical_string(mem_ctx, result->dn);
+ W_ERROR_HAVE_NO_MEMORY(s);
+ p = strchr(s, '/');
if (p) {
p[0] = '\0';
}
+ info1->dns_domain_name = s;
/* here we can use result and domain_res[0] */
switch (format_desired) {
{
WERROR werr;
struct drsuapi_DsNameInfo1 info1;
- char *p;
+ char *s = NULL;
+ char *p = NULL;
/* Handle anonymous bind */
if (!name || !*name) {
return NT_STATUS_UNSUCCESSFUL;
}
- *nt4_domain = talloc_strdup(mem_ctx, info1.result_name);
- if (*nt4_domain == NULL) {
+ s = talloc_strdup(mem_ctx, info1.result_name);
+ if (s == NULL) {
return NT_STATUS_NO_MEMORY;
}
- p = strchr(*nt4_domain, '\\');
+ p = strchr(s, '\\');
if (!p) {
return NT_STATUS_INVALID_PARAMETER;
}
p[0] = '\0';
+ *nt4_domain = s;
*nt4_account = talloc_strdup(mem_ctx, &p[1]);
if (*nt4_account == NULL) {
"fSMORoleOwner",
NULL
};
+ char *s;
char *p;
int ret;
state->domain_name = lpcfg_sam_name(dce_call->conn->dce_ctx->lp_ctx);
- state->domain_dns = ldb_dn_canonical_string(state, state->domain_dn);
- if (!state->domain_dns) {
+ s = ldb_dn_canonical_string(state, state->domain_dn);
+ if (!s) {
return NT_STATUS_NO_SUCH_DOMAIN;
}
- p = strchr(state->domain_dns, '/');
+ p = strchr(s, '/');
if (p) {
*p = '\0';
}
+ state->domain_dns = s;
- state->forest_dns = ldb_dn_canonical_string(state, state->forest_dn);
- if (!state->forest_dns) {
+ s = ldb_dn_canonical_string(state, state->forest_dn);
+ if (!s) {
return NT_STATUS_NO_SUCH_DOMAIN;
}
- p = strchr(state->forest_dns, '/');
+ p = strchr(s, '/');
if (p) {
*p = '\0';
}
+ state->forest_dns = s;
/* work out the builtin_dn - useful for so many calls its worth
fetching here */