Skip to content

Commit fdb6262

Browse files
committed
main UPDATE support having local users disabled
1 parent e934dbf commit fdb6262

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/main.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,8 @@ server_data_subscribe(void)
11581158
{
11591159
int rc;
11601160
const char *mod_name, *xpath;
1161+
const struct lys_module *mod;
1162+
const struct ly_ctx *ly_ctx;
11611163

11621164
#define SR_OPER_SUBSCR(mod_name, xpath, cb) \
11631165
rc = sr_oper_get_subscribe(np2srv.sr_sess, mod_name, xpath, cb, NULL, 0, &np2srv.sr_data_sub); \
@@ -1203,12 +1205,19 @@ server_data_subscribe(void)
12031205
mod_name = "ietf-tls-common";
12041206
SR_OPER_SUBSCR(mod_name, "/ietf-tls-common:supported-algorithms", np2srv_tls_algs_oper_cb);
12051207

1206-
/* password last modified oper data for both listen + call-home SSH users */
1207-
mod_name = "ietf-netconf-server";
1208-
SR_OPER_SUBSCR(mod_name, "/ietf-netconf-server:netconf-server/listen/endpoints/endpoint/ssh/"
1209-
"ssh-server-parameters/client-authentication/users/user/password/last-modified", np2srv_password_last_modified_oper_cb);
1210-
SR_OPER_SUBSCR(mod_name, "/ietf-netconf-server:netconf-server/call-home/netconf-client/endpoints/endpoint/ssh/"
1211-
"ssh-server-parameters/client-authentication/users/user/password/last-modified", np2srv_password_last_modified_oper_cb);
1208+
ly_ctx = sr_acquire_context(np2srv.sr_conn);
1209+
mod = ly_ctx_get_module_implemented(ly_ctx, "ietf-ssh-server");
1210+
sr_release_context(np2srv.sr_conn);
1211+
if (!lys_feature_value(mod, "local-users-supported")) {
1212+
/* password last modified oper data for both listen + call-home SSH users */
1213+
mod_name = "ietf-netconf-server";
1214+
SR_OPER_SUBSCR(mod_name, "/ietf-netconf-server:netconf-server/listen/endpoints/endpoint/ssh/"
1215+
"ssh-server-parameters/client-authentication/users/user/password/last-modified",
1216+
np2srv_password_last_modified_oper_cb);
1217+
SR_OPER_SUBSCR(mod_name, "/ietf-netconf-server:netconf-server/call-home/netconf-client/endpoints/endpoint/ssh/"
1218+
"ssh-server-parameters/client-authentication/users/user/password/last-modified",
1219+
np2srv_password_last_modified_oper_cb);
1220+
}
12121221
#endif /* NC_ENABLED_SSH_TLS */
12131222

12141223
/* subscriptions to running DS */

0 commit comments

Comments
 (0)