-/*
+/*
Unix SMB/CIFS mplementation.
DSDB schema syntaxes
-
+
Copyright (C) Stefan Metzmacher <metze@samba.org> 2006
Copyright (C) Simo Sorce 2005
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-
+
*/
#include "includes.h"
#include "dsdb/samdb/samdb.h"
v *= 10000000;
t = nt_time_to_unix(v);
- /*
+ /*
* NOTE: On a w2k3 server you can set a GeneralizedTime string
* via LDAP, but you get back an UTCTime string,
* but via DRSUAPI you get back the NTTIME_1sec value
* So if we store the UTCTime string in our ldb
* we'll loose information!
*/
- str = ldb_timestring_utc(out->values, t);
+ str = ldb_timestring_utc(out->values, t);
W_ERROR_HAVE_NO_MEMORY(str);
out->values[i] = data_blob_string_const(str);
}
v *= 10000000;
t = nt_time_to_unix(v);
- str = ldb_timestring(out->values, t);
+ str = ldb_timestring(out->values, t);
W_ERROR_HAVE_NO_MEMORY(str);
out->values[i] = data_blob_string_const(str);
const struct dsdb_attribute *attr,
const struct ldb_message_element *in,
TALLOC_CTX *mem_ctx,
- struct drsuapi_DsReplicaAttribute *out)
+ struct drsuapi_DsReplicaAttribute *out)
{
unsigned int i;
DATA_BLOB *blobs;
werr = _dsdb_syntax_OID_obj_drsuapi_to_ldb(ctx, attr, in, mem_ctx, out);
break;
case DRSUAPI_ATTRIBUTE_systemMustContain:
- case DRSUAPI_ATTRIBUTE_systemMayContain:
+ case DRSUAPI_ATTRIBUTE_systemMayContain:
case DRSUAPI_ATTRIBUTE_mustContain:
case DRSUAPI_ATTRIBUTE_rDNAttId:
case DRSUAPI_ATTRIBUTE_transportAddressAttribute:
case DRSUAPI_ATTRIBUTE_possSuperiors:
return _dsdb_syntax_OID_obj_ldb_to_drsuapi(ctx, attr, in, mem_ctx, out);
case DRSUAPI_ATTRIBUTE_systemMustContain:
- case DRSUAPI_ATTRIBUTE_systemMayContain:
+ case DRSUAPI_ATTRIBUTE_systemMayContain:
case DRSUAPI_ATTRIBUTE_mustContain:
case DRSUAPI_ATTRIBUTE_rDNAttId:
case DRSUAPI_ATTRIBUTE_transportAddressAttribute:
return WERR_FOOBAR;
}
- if (!convert_string_talloc(out->values,
- CH_UTF16, CH_UNIX,
- in->value_ctr.values[i].blob->data,
- in->value_ctr.values[i].blob->length,
- (void **)&str, NULL, false)) {
+ if (!convert_string_talloc(out->values,
+ CH_UTF16, CH_UNIX,
+ in->value_ctr.values[i].blob->data,
+ in->value_ctr.values[i].blob->length,
+ (void **)&str, NULL, false)) {
return WERR_FOOBAR;
}
out->value_ctr.values[i].blob = &blobs[i];
if (!convert_string_talloc(blobs,
- CH_UNIX, CH_UTF16,
- in->values[i].data, in->values[i].length,
- (void **)&blobs[i].data, &blobs[i].length, false)) {
- return WERR_FOOBAR;
+ CH_UNIX, CH_UTF16,
+ in->values[i].data, in->values[i].length,
+ (void **)&blobs[i].data, &blobs[i].length, false)) {
+ return WERR_FOOBAR;
}
}
}
ok = convert_string_talloc(ctx->ldb,
- CH_UNIX, CH_UTF16,
- val->data,
- val->length,
- (void **)&dst,
- &size, false);
+ CH_UNIX, CH_UTF16,
+ val->data,
+ val->length,
+ (void **)&dst,
+ &size, false);
TALLOC_FREE(dst);
if (!ok) {
return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
return WERR_OK;
}
-WERROR dsdb_syntax_one_DN_drsuapi_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
- const struct dsdb_syntax *syntax,
+WERROR dsdb_syntax_one_DN_drsuapi_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
+ const struct dsdb_syntax *syntax,
const DATA_BLOB *in, DATA_BLOB *out)
{
struct drsuapi_DsReplicaObjectIdentifier3 id3;
if (!tmp_ctx) {
W_ERROR_HAVE_NO_MEMORY(tmp_ctx);
}
-
+
if (in == NULL) {
talloc_free(tmp_ctx);
return WERR_FOOBAR;
}
-
+
if (in->length == 0) {
talloc_free(tmp_ctx);
return WERR_FOOBAR;
}
-
-
+
+
/* windows sometimes sends an extra two pad bytes here */
ndr_err = ndr_pull_struct_blob(in,
tmp_ctx, &id3,
talloc_free(tmp_ctx);
return ntstatus_to_werror(status);
}
-
+
dn = ldb_dn_new(tmp_ctx, ldb, id3.dn);
if (!dn) {
talloc_free(tmp_ctx);
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);
}
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,
talloc_free(tmp_ctx);
return ntstatus_to_werror(status);
}
-
+
ret = ldb_dn_set_extended_component(dn, "SID", &sid_blob);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
return WERR_FOOBAR;
}
}
-
+
*out = data_blob_string_const(ldb_dn_get_extended_linearized(mem_ctx, dn, 1));
talloc_free(tmp_ctx);
return WERR_OK;
for (i=0; i < out->num_values; i++) {
WERROR status = dsdb_syntax_one_DN_drsuapi_to_ldb(out->values, ctx->ldb, attr->syntax,
- in->value_ctr.values[i].blob,
+ in->value_ctr.values[i].blob,
&out->values[i]);
if (!W_ERROR_IS_OK(status)) {
return status;
}
-
+
}
return WERR_OK;
return WERR_FOOBAR;
}
-
+
/* windows sometimes sends an extra two pad bytes here */
ndr_err = ndr_pull_struct_blob(in->value_ctr.values[i].blob,
tmp_ctx, &id3,
sid_blob = ldb_dn_get_extended_component(dsdb_dn->dn, "SID");
if (sid_blob) {
-
- ndr_err = ndr_pull_struct_blob_all(sid_blob,
+
+ ndr_err = ndr_pull_struct_blob_all(sid_blob,
tmp_ctx, &id3.sid,
(ndr_pull_flags_fn_t)ndr_pull_dom_sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
}
if (!convert_string_talloc(out->values, CH_UTF16, CH_UNIX,
- in->value_ctr.values[i].blob->data+4,
- in->value_ctr.values[i].blob->length-4,
- (void **)&str, NULL, false)) {
+ in->value_ctr.values[i].blob->data+4,
+ in->value_ctr.values[i].blob->length-4,
+ (void **)&str, NULL, false)) {
return WERR_FOOBAR;
}
out->value_ctr.values[i].blob = &blobs[i];
if (!convert_string_talloc(blobs, CH_UNIX, CH_UTF16,
- in->values[i].data,
- in->values[i].length,
- (void **)&data, &ret, false)) {
+ in->values[i].data,
+ in->values[i].length,
+ (void **)&data, &ret, false)) {
return WERR_FOOBAR;
}
.ldb_to_drsuapi = dsdb_syntax_BOOL_ldb_to_drsuapi,
.validate_ldb = dsdb_syntax_BOOL_validate_ldb,
.equality = "booleanMatch",
- .comment = "Boolean"
+ .comment = "Boolean"
},{
.name = "Integer",
.ldap_oid = LDB_SYNTAX_INTEGER,
.equality = "caseIgnoreMatch",
.ldb_syntax = LDB_SYNTAX_DN,
},{
- /*
+ /*
* TODO: verify if DATA_BLOB is correct here...!
*
* repsFrom and repsTo are the only attributes using
- * this attribute syntax, but they're not replicated...
+ * this attribute syntax, but they're not replicated...
*/
.name = "Object(Replica-Link)",
.ldap_oid = "1.3.6.1.4.1.1466.115.121.1.40",
}
};
-const struct dsdb_syntax *find_syntax_map_by_ad_oid(const char *ad_oid)
+const struct dsdb_syntax *find_syntax_map_by_ad_oid(const char *ad_oid)
{
unsigned int i;
for (i=0; dsdb_syntaxes[i].ldap_oid; i++) {
return NULL;
}
-const struct dsdb_syntax *find_syntax_map_by_ad_syntax(int oMSyntax)
+const struct dsdb_syntax *find_syntax_map_by_ad_syntax(int oMSyntax)
{
unsigned int i;
for (i=0; dsdb_syntaxes[i].ldap_oid; i++) {
return NULL;
}
-const struct dsdb_syntax *find_syntax_map_by_standard_oid(const char *standard_oid)
+const struct dsdb_syntax *find_syntax_map_by_standard_oid(const char *standard_oid)
{
unsigned int i;
for (i=0; dsdb_syntaxes[i].ldap_oid; i++) {
}
return NULL;
}
+
const struct dsdb_syntax *dsdb_syntax_for_attribute(const struct dsdb_attribute *attr)
{
unsigned int i;
return NULL;
}
-WERROR dsdb_attribute_drsuapi_to_ldb(struct ldb_context *ldb,
+WERROR dsdb_attribute_drsuapi_to_ldb(struct ldb_context *ldb,
const struct dsdb_schema *schema,
const struct drsuapi_DsReplicaAttribute *in,
TALLOC_CTX *mem_ctx,
return sa->syntax->drsuapi_to_ldb(&syntax_ctx, sa, in, mem_ctx, out);
}
-WERROR dsdb_attribute_ldb_to_drsuapi(struct ldb_context *ldb,
+WERROR dsdb_attribute_ldb_to_drsuapi(struct ldb_context *ldb,
const struct dsdb_schema *schema,
const struct ldb_message_element *in,
TALLOC_CTX *mem_ctx,