+++ /dev/null
-^samba4.unicodepwd_encrypted\(.*\).__main__.UnicodePwdEncryptedConnectionTests.test_simple_bind_plain
-^samba4.unicodepwd_encrypted\(.*\).__main__.UnicodePwdEncryptedConnectionTests.test_without_seal
struct loadparm_context *lp_ctx =
talloc_get_type(ldb_get_opaque(ldb, "loadparm"),
struct loadparm_context);
+ struct dsdb_encrypted_connection_state *opaque_connection_state =
+ ldb_get_opaque(ldb,DSDB_OPAQUE_ENCRYPTED_CONNECTION_STATE_NAME);
*werror = WERR_INVALID_PARAMETER;
return LDB_SUCCESS;
}
+ /*
+ * Prevent update password on an insecure connection.
+ * The opaque is added in the ldap backend init.
+ */
+ if (opaque_connection_state != NULL &&
+ !opaque_connection_state->using_encrypted_connection) {
+ ret = LDB_ERR_UNWILLING_TO_PERFORM;
+ *werror = WERR_GEN_FAILURE;
+ ldb_asprintf_errstring(ldb,
+ "%08X: SvcErr: DSID-031A126C, "
+ "problem 5003 (WILL_NOT_PERFORM), "
+ "data 0\n"
+ "Password modification over LDAP "
+ "must be over an encrypted connection",
+ W_ERROR_V(*werror));
+ return ret;
+ }
+
/*
* First check the old password is correct, for password
* changes when this hasn't already been checked by a
#define DSDB_FULL_JOIN_REPLICATION_COMPLETED_OPAQUE_NAME "DSDB_FULL_JOIN_REPLICATION_COMPLETED"
+#define DSDB_OPAQUE_ENCRYPTED_CONNECTION_STATE_NAME "DSDB_OPAQUE_ENCRYPTED_CONNECTION_STATE_MSG"
+struct dsdb_encrypted_connection_state {
+ bool using_encrypted_connection;
+};
+
#define DSDB_SAMDB_MINIMUM_ALLOWED_RID 1000
#define DSDB_METADATA_SCHEMA_SEQ_NUM "SCHEMA_SEQ_NUM"
int ldapsrv_backend_Init(struct ldapsrv_connection *conn,
char **errstring)
{
+ bool using_tls = conn->sockets.active == conn->sockets.tls;
+ bool using_seal = conn->gensec != NULL && gensec_have_feature(conn->gensec,
+ GENSEC_FEATURE_SEAL);
+ struct dsdb_encrypted_connection_state *opaque_connection_state = NULL;
+
int ret = samdb_connect_url(conn,
conn->connection->event.ctx,
conn->lp_ctx,
return ret;
}
+ /*
+ * We can safely call ldb_set_opaque() on this ldb as we have
+ * set remote_address above which avoids the ldb handle cache
+ */
+ opaque_connection_state = talloc_zero(conn, struct dsdb_encrypted_connection_state);
+ if (opaque_connection_state == NULL) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ opaque_connection_state->using_encrypted_connection = using_tls || using_seal;
+ ret = ldb_set_opaque(conn->ldb,
+ DSDB_OPAQUE_ENCRYPTED_CONNECTION_STATE_NAME,
+ opaque_connection_state);
+ if (ret != LDB_SUCCESS) {
+ DBG_ERR("ldb_set_opaque() failed to store our "
+ "encrypted connection state!");
+ return ret;
+ }
+
if (conn->server_credentials) {
struct gensec_security *gensec_security = NULL;
const char **sasl_mechs = NULL;