ganeshmurthy commented on a change in pull request #472: Dispatch 1288 1 - policy for outbound connectors URL: https://github.com/apache/qpid-dispatch/pull/472#discussion_r267841149
########## File path: src/policy.c ########## @@ -404,18 +409,47 @@ bool qd_policy_open_lookup_user( } else { qd_log(policy->log_source, QD_LOG_DEBUG, "Internal: lookup_user: lookup_user"); } + Py_XDECREF(module); } - if (!res) { - if (module) { - Py_XDECREF(module); - } - qd_python_unlock(lock_state); - return false; - } + qd_python_unlock(lock_state); - // if (name_buf[0]) { - // Go get the named settings + qd_log(policy->log_source, + QD_LOG_TRACE, + "[%"PRIu64"]: ALLOW AMQP Open lookup_user: %s, rhost: %s, vhost: %s, connection: %s. Usergroup: '%s'%s", + conn_id, username, hostip, vhost, conn_name, name_buf, (res ? "" : " Internal error.")); + } + return res; +} + + +/** Fetch policy settings for a vhost/group + * A vhost database user group name has been returned by qd_policy_open_lookup_user + * or by some configuration value. Access the vhost database for that group and + * extract the run-time settings. + * @param[in] policy pointer to policy + * @param[in] username authenticated user name (for logging) + * @param[in] hostip numeric host ip address (for logging) + * @param[in] vhost vhost name + * @param[in] conn_name connection name for tracking (for logging) + * @param[in] name_buf group name that holds the settings of interest + * @param[in] conn_id connection id for log tracking (for logging) + * @param[out] settings pointer to settings object to be filled with policy values + **/ +bool qd_policy_open_fetch_settings( + qd_policy_t *policy, + const char *username, + const char *hostip, + const char *vhost, + const char *conn_name, + const char *name_buf, + uint64_t conn_id, + qd_policy_settings_t *settings) +{ + bool res = false; + qd_python_lock_state_t lock_state = qd_python_lock(); + PyObject *module = PyImport_ImportModule("qpid_dispatch_internal.policy.policy_manager"); + if (module) { res = false; Review comment: res is already false ? (initialized to false) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org