char *o = s;
int i;
const char *t_name = NULL;
+ bool option_section = false;
+ const char *target_hostname = NULL;
if (b->transport != NCA_UNKNOWN) {
t_name = derpc_transport_string_by_transport(b->transport);
}
}
- if (!b->endpoint && !b->options && !b->flags) {
+ target_hostname = b->target_hostname;
+ if (target_hostname != NULL && b->host != NULL) {
+ if (strcmp(target_hostname, b->host) == 0) {
+ target_hostname = NULL;
+ }
+ }
+
+ if (b->endpoint) {
+ option_section = true;
+ } else if (target_hostname) {
+ option_section = true;
+ } else if (b->target_principal) {
+ option_section = true;
+ } else if (b->assoc_group_id != 0) {
+ option_section = true;
+ } else if (b->options) {
+ option_section = true;
+ } else if (b->flags) {
+ option_section = true;
+ }
+
+ if (!option_section) {
return s;
}
}
}
+ if (target_hostname) {
+ o = s;
+ s = talloc_asprintf_append_buffer(s, ",target_hostname=%s",
+ b->target_hostname);
+ if (s == NULL) {
+ talloc_free(o);
+ return NULL;
+ }
+ }
+
+ if (b->target_principal) {
+ o = s;
+ s = talloc_asprintf_append_buffer(s, ",target_principal=%s",
+ b->target_principal);
+ if (s == NULL) {
+ talloc_free(o);
+ return NULL;
+ }
+ }
+
+ if (b->assoc_group_id != 0) {
+ o = s;
+ s = talloc_asprintf_append_buffer(s, ",assoc_group_id=0x%08x",
+ b->assoc_group_id);
+ if (s == NULL) {
+ talloc_free(o);
+ return NULL;
+ }
+ }
+
for (i=0;b->options && b->options[i];i++) {
o = s;
s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);