summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorIsaac Boukris <iboukris@gmail.com>2019-09-18 20:00:34 +0300
committerRalph Boehme <slow@samba.org>2019-10-25 09:21:44 +0000
commit4cbad1eb46896bbd74c5b19dbb0a8937ffde90c2 (patch)
tree991fc2c716fadf167291b660029954e86536b37d /source3/libnet
parent05f7e9a72a1769af9d41b1ca40fe6a14b3f069d1 (diff)
downloadsamba-4cbad1eb46896bbd74c5b19dbb0a8937ffde90c2.tar.gz
libnet_join_set_machine_spn: improve style and make a bit room for indentation
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14116 Signed-off-by: Isaac Boukris <iboukris@redhat.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_join.c95
1 files changed, 47 insertions, 48 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 818b3039cb9..67ab50c68a8 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -517,7 +517,7 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
/* Windows only creates HOST/shortname & HOST/fqdn. */
spn = talloc_asprintf(mem_ctx, "HOST/%s", r->in.machine_name);
- if (!spn) {
+ if (spn == NULL) {
return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
}
if (!strupper_m(spn)) {
@@ -553,60 +553,59 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
}
}
- netbios_aliases = lp_netbios_aliases();
- if (netbios_aliases != NULL) {
- for (; *netbios_aliases != NULL; netbios_aliases++) {
- /*
- * Add HOST/NETBIOSNAME
- */
- spn = talloc_asprintf(mem_ctx, "HOST/%s", *netbios_aliases);
- if (spn == NULL) {
- TALLOC_FREE(spn);
- return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
- }
- if (!strupper_m(spn)) {
- TALLOC_FREE(spn);
- return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
- }
+ for (netbios_aliases = lp_netbios_aliases();
+ netbios_aliases != NULL && *netbios_aliases != NULL;
+ netbios_aliases++) {
+ /*
+ * Add HOST/NETBIOSNAME
+ */
+ spn = talloc_asprintf(mem_ctx, "HOST/%s", *netbios_aliases);
+ if (spn == NULL) {
+ TALLOC_FREE(spn);
+ return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ }
+ if (!strupper_m(spn)) {
+ TALLOC_FREE(spn);
+ return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ }
- ok = ads_element_in_array(spn_array, num_spns, spn);
- if (ok) {
- TALLOC_FREE(spn);
- continue;
- }
- ok = add_string_to_array(spn_array, spn,
- &spn_array, &num_spns);
- if (!ok) {
- TALLOC_FREE(spn);
- return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
- }
+ ok = ads_element_in_array(spn_array, num_spns, spn);
+ if (ok) {
+ TALLOC_FREE(spn);
+ continue;
+ }
+ ok = add_string_to_array(spn_array, spn,
+ &spn_array, &num_spns);
+ if (!ok) {
TALLOC_FREE(spn);
+ return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ }
+ TALLOC_FREE(spn);
- /*
- * Add HOST/netbiosname.domainname
- */
- fstr_sprintf(my_fqdn, "%s.%s",
- *netbios_aliases,
- lp_dnsdomain());
+ /*
+ * Add HOST/netbiosname.domainname
+ */
+ fstr_sprintf(my_fqdn, "%s.%s",
+ *netbios_aliases,
+ lp_dnsdomain());
- spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn);
- if (spn == NULL) {
- return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
- }
+ spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn);
+ if (spn == NULL) {
+ return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ }
- ok = ads_element_in_array(spn_array, num_spns, spn);
- if (ok) {
- TALLOC_FREE(spn);
- continue;
- }
- ok = add_string_to_array(spn_array, spn,
- &spn_array, &num_spns);
- if (!ok) {
- TALLOC_FREE(spn);
- return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
- }
+ ok = ads_element_in_array(spn_array, num_spns, spn);
+ if (ok) {
+ TALLOC_FREE(spn);
+ continue;
+ }
+ ok = add_string_to_array(spn_array, spn,
+ &spn_array, &num_spns);
+ if (!ok) {
TALLOC_FREE(spn);
+ return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
}
+ TALLOC_FREE(spn);
}
/* make sure to NULL terminate the array */