blobs[i] = data_blob_talloc(blobs, NULL, 4);
W_ERROR_HAVE_NO_MEMORY(blobs[i].data);
- if (strcmp("TRUE", (const char *)in->values[i].data) == 0) {
+ if (in->values[i].length >= 4 &&
+ strncmp("TRUE", (const char *)in->values[i].data, in->values[i].length) == 0) {
SIVAL(blobs[i].data, 0, 0x00000001);
- } else if (strcmp("FALSE", (const char *)in->values[i].data) == 0) {
+ } else if (in->values[i].length >= 5 &&
+ strncmp("FALSE", (const char *)in->values[i].data, in->values[i].length) == 0) {
SIVAL(blobs[i].data, 0, 0x00000000);
} else {
return WERR_FOOBAR;
}
for (i=0; i < in->num_values; i++) {
- int t, f;
-
if (in->values[i].length == 0) {
return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
}
- t = strncmp("TRUE",
+ if (in->values[i].length >= 4 &&
+ strncmp("TRUE",
(const char *)in->values[i].data,
- in->values[i].length);
- f = strncmp("FALSE",
+ in->values[i].length) == 0) {
+ continue;
+ }
+ if (in->values[i].length >= 5 &&
+ strncmp("FALSE",
(const char *)in->values[i].data,
- in->values[i].length);
-
- if (t != 0 && f != 0) {
- return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+ in->values[i].length) == 0) {
+ continue;
}
+ return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
}
return WERR_OK;
}
v = BVAL(in->value_ctr.values[i].blob->data, 0);
+ if (v == 0) {
+ /* special case for 1601 zero timestamp */
+ out->values[i] = data_blob_string_const("16010101000000.0Z");
+ continue;
+ }
v *= 10000000;
t = nt_time_to_unix(v);
blobs[i] = data_blob_talloc(blobs, NULL, 8);
W_ERROR_HAVE_NO_MEMORY(blobs[i].data);
+ if (ldb_val_string_cmp("16010101000000.0Z", &in->values[i]) == 0) {
+ SBVALS(blobs[i].data, 0, 0);
+ continue;
+ }
+
t = ldb_string_utc_to_time((const char *)in->values[i].data);
unix_to_nt_time(&v, t);
v /= 10000000;
}
memcpy(buf, in->values[i].data, in->values[i].length);
- errno = 0;
t = ldb_string_utc_to_time(buf);
- if (errno != 0) {
+ if (t == 0) {
return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
}
}
v = BVAL(in->value_ctr.values[i].blob->data, 0);
+ if (v == 0) {
+ /* special case for 1601 zero timestamp */
+ out->values[i] = data_blob_string_const("16010101000000.0Z");
+ continue;
+ }
v *= 10000000;
t = nt_time_to_unix(v);
blobs[i] = data_blob_talloc(blobs, NULL, 8);
W_ERROR_HAVE_NO_MEMORY(blobs[i].data);
+ if (ldb_val_string_cmp("16010101000000.0Z", &in->values[i]) == 0) {
+ SBVALS(blobs[i].data, 0, 0);
+ continue;
+ }
+
ret = ldb_val_to_time(&in->values[i], &t);
if (ret != LDB_SUCCESS) {
return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
struct ldb_message_element *out)
{
unsigned int i;
+ const struct dsdb_schema_prefixmap *prefixmap;
- SMB_ASSERT(ctx->pfm_remote);
+ if (ctx->pfm_remote != NULL) {
+ prefixmap = ctx->pfm_remote;
+ } else {
+ prefixmap = ctx->schema->prefixmap;
+ }
+ SMB_ASSERT(prefixmap);
out->flags = 0;
out->name = talloc_strdup(mem_ctx, attr->lDAPDisplayName);
attid = IVAL(in->value_ctr.values[i].blob->data, 0);
- status = dsdb_schema_pfm_oid_from_attid(ctx->pfm_remote, attid,
+ status = dsdb_schema_pfm_oid_from_attid(prefixmap, attid,
out->values, &oid);
if (!W_ERROR_IS_OK(status)) {
DEBUG(0,(__location__ ": Error: Unknown ATTID 0x%08X\n",
W_ERROR_HAVE_NO_MEMORY(dn);
}
- status = GUID_to_ndr_blob(&id3.guid, tmp_ctx, &guid_blob);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(tmp_ctx);
- return ntstatus_to_werror(status);
- }
+ if (!GUID_all_zero(&id3.guid)) {
+ status = GUID_to_ndr_blob(&id3.guid, tmp_ctx, &guid_blob);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(tmp_ctx);
+ return ntstatus_to_werror(status);
+ }
- ret = ldb_dn_set_extended_component(dn, "GUID", &guid_blob);
- if (ret != LDB_SUCCESS) {
- talloc_free(tmp_ctx);
- return WERR_FOOBAR;
+ ret = ldb_dn_set_extended_component(dn, "GUID", &guid_blob);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(tmp_ctx);
+ return WERR_FOOBAR;
+ }
+ talloc_free(guid_blob.data);
}
- talloc_free(guid_blob.data);
-
if (id3.__ndr_size_sid) {
DATA_BLOB sid_blob;
ndr_err = ndr_push_struct_blob(&sid_blob, tmp_ctx, &id3.sid,
.ldb_to_drsuapi = dsdb_syntax_BOOL_ldb_to_drsuapi,
.validate_ldb = dsdb_syntax_BOOL_validate_ldb,
.equality = "booleanMatch",
- .comment = "Boolean"
+ .comment = "Boolean",
+ .auto_normalise = true
},{
.name = "Integer",
.ldap_oid = LDB_SYNTAX_INTEGER,
.validate_ldb = dsdb_syntax_INT32_validate_ldb,
.equality = "integerMatch",
.comment = "Integer",
- .ldb_syntax = LDB_SYNTAX_SAMBA_INT32
+ .ldb_syntax = LDB_SYNTAX_SAMBA_INT32,
+ .auto_normalise = true
},{
.name = "String(Octet)",
.ldap_oid = LDB_SYNTAX_OCTET_STRING,
.drsuapi_to_ldb = dsdb_syntax_INT32_drsuapi_to_ldb,
.ldb_to_drsuapi = dsdb_syntax_INT32_ldb_to_drsuapi,
.validate_ldb = dsdb_syntax_INT32_validate_ldb,
- .ldb_syntax = LDB_SYNTAX_SAMBA_INT32
+ .ldb_syntax = LDB_SYNTAX_SAMBA_INT32,
+ .auto_normalise = true
},{
/* not used in w2k3 forest */
.name = "String(Numeric)",
.validate_ldb = dsdb_syntax_NTTIME_UTC_validate_ldb,
.equality = "generalizedTimeMatch",
.comment = "UTC Time",
+ .auto_normalise = true
},{
.name = "String(Generalized-Time)",
.ldap_oid = "1.3.6.1.4.1.1466.115.121.1.24",
.equality = "generalizedTimeMatch",
.comment = "Generalized Time",
.ldb_syntax = LDB_SYNTAX_UTC_TIME,
+ .auto_normalise = true
},{
/* not used in w2k3 schema */
.name = "String(Case Sensitive)",
.equality = "integerMatch",
.comment = "Large Integer",
.ldb_syntax = LDB_SYNTAX_INTEGER,
+ .auto_normalise = true
},{
.name = "String(NT-Sec-Desc)",
.ldap_oid = LDB_SYNTAX_SAMBA_SECURITY_DESCRIPTOR,