~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source4/libcli/ldap/ldap_controls.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include "includes.h"
23
23
#include "../lib/util/asn1.h"
24
 
#include "libcli/ldap/ldap.h"
25
 
#include "lib/ldb/include/ldb.h"
 
24
#include "libcli/ldap/libcli_ldap.h"
26
25
#include "libcli/ldap/ldap_proto.h"
27
26
#include "dsdb/samdb/samdb.h"
28
27
 
214
213
                return false;
215
214
        }
216
215
 
217
 
        if (!asn1_read_Integer(data, &(lsdfc->secinfo_flags))) {
 
216
        if (!asn1_read_Integer(data, (int *) &(lsdfc->secinfo_flags))) {
218
217
                return false;
219
218
        }
220
219
 
248
247
                return false;
249
248
        }
250
249
 
251
 
        if (!asn1_read_Integer(data, &(lsoc->search_options))) {
 
250
        if (!asn1_read_Integer(data, (int *) &(lsoc->search_options))) {
252
251
                return false;
253
252
        }
254
253
 
427
426
        return true;
428
427
}
429
428
 
430
 
static bool decode_domain_scope_request(void *mem_ctx, DATA_BLOB in, void *_out)
431
 
{
432
 
        if (in.length != 0) {
433
 
                return false;
434
 
        }
435
 
 
436
 
        return true;
437
 
}
438
 
 
439
 
static bool decode_notification_request(void *mem_ctx, DATA_BLOB in, void *_out)
440
 
{
441
 
        if (in.length != 0) {
442
 
                return false;
443
 
        }
444
 
 
445
 
        return true;
446
 
}
447
 
 
448
 
static bool decode_show_deleted_request(void *mem_ctx, DATA_BLOB in, void *_out)
449
 
{
450
 
        if (in.length != 0) {
451
 
                return false;
452
 
        }
453
 
 
454
 
        return true;
455
 
}
456
 
 
457
 
static bool decode_show_recycled_request(void *mem_ctx, DATA_BLOB in, void *_out)
458
 
{
459
 
        if (in.length != 0) {
460
 
                return false;
461
 
        }
462
 
 
463
 
        return true;
464
 
}
465
 
 
466
 
static bool decode_show_deactivated_link_request(void *mem_ctx, DATA_BLOB in, void *_out)
467
 
{
468
 
        if (in.length != 0) {
469
 
                return false;
470
 
        }
471
 
 
472
 
        return true;
473
 
}
474
 
 
475
 
static bool decode_permissive_modify_request(void *mem_ctx, DATA_BLOB in, void *_out)
476
 
{
477
 
        if (in.length != 0) {
478
 
                return false;
479
 
        }
480
 
 
481
 
        return true;
482
 
}
483
 
 
484
 
static bool decode_manageDSAIT_request(void *mem_ctx, DATA_BLOB in, void *_out)
485
 
{
486
 
        if (in.length != 0) {
487
 
                return false;
488
 
        }
489
 
 
490
 
        return true;
491
 
}
492
 
 
493
429
static bool decode_vlv_request(void *mem_ctx, DATA_BLOB in, void *_out)
494
430
{
495
431
        void **out = (void **)_out;
949
885
        return true;
950
886
}
951
887
 
952
 
static bool encode_domain_scope_request(void *mem_ctx, void *in, DATA_BLOB *out)
953
 
{
954
 
        if (in) {
955
 
                return false;
956
 
        }
957
 
 
958
 
        *out = data_blob(NULL, 0);
959
 
        return true;
960
 
}
961
 
 
962
 
static bool encode_notification_request(void *mem_ctx, void *in, DATA_BLOB *out)
963
 
{
964
 
        if (in) {
965
 
                return false;
966
 
        }
967
 
 
968
 
        *out = data_blob(NULL, 0);
969
 
        return true;
970
 
}
971
 
 
972
 
static bool encode_show_deleted_request(void *mem_ctx, void *in, DATA_BLOB *out)
973
 
{
974
 
        if (in) {
975
 
                return false;
976
 
        }
977
 
 
978
 
        *out = data_blob(NULL, 0);
979
 
        return true;
980
 
}
981
 
 
982
 
static bool encode_show_recycled_request(void *mem_ctx, void *in, DATA_BLOB *out)
983
 
{
984
 
        if (in) {
985
 
                return false;
986
 
        }
987
 
 
988
 
        *out = data_blob(NULL, 0);
989
 
        return true;
990
 
}
991
 
 
992
 
static bool encode_show_deactivated_link_request(void *mem_ctx, void *in, DATA_BLOB *out)
993
 
{
994
 
        if (in) {
995
 
                return false;
996
 
        }
997
 
 
998
 
        *out = data_blob(NULL, 0);
999
 
        return true;
1000
 
}
1001
 
 
1002
 
static bool encode_permissive_modify_request(void *mem_ctx, void *in, DATA_BLOB *out)
1003
 
{
1004
 
        if (in) {
1005
 
                return false;
1006
 
        }
1007
 
 
1008
 
        *out = data_blob(NULL, 0);
1009
 
        return true;
1010
 
}
1011
 
 
1012
 
static bool encode_manageDSAIT_request(void *mem_ctx, void *in, DATA_BLOB *out)
1013
 
{
1014
 
        if (in) {
1015
 
                return false;
1016
 
        }
1017
 
 
1018
 
        *out = data_blob(NULL, 0);
1019
 
        return true;
1020
 
}
1021
 
 
1022
888
static bool encode_vlv_request(void *mem_ctx, void *in, DATA_BLOB *out)
1023
889
{
1024
890
        struct ldb_vlv_req_control *lvrc = talloc_get_type(in, struct ldb_vlv_req_control);
1251
1117
        return true;
1252
1118
}
1253
1119
 
 
1120
static bool encode_flag_request(void *mem_ctx, void *in, DATA_BLOB *out)
 
1121
{
 
1122
        if (in) {
 
1123
                return false;
 
1124
        }
 
1125
 
 
1126
        *out = data_blob(NULL, 0);
 
1127
        return true;
 
1128
}
 
1129
 
 
1130
static bool decode_flag_request(void *mem_ctx, DATA_BLOB in, void *_out)
 
1131
{
 
1132
        if (in.length != 0) {
 
1133
                return false;
 
1134
        }
 
1135
 
 
1136
        return true;
 
1137
}
 
1138
 
1254
1139
static const struct ldap_control_handler ldap_known_controls[] = {
1255
 
        { "1.2.840.113556.1.4.319", decode_paged_results_request, encode_paged_results_request },
1256
 
        { "1.2.840.113556.1.4.529", decode_extended_dn_request, encode_extended_dn_request },
1257
 
        { "1.2.840.113556.1.4.473", decode_server_sort_request, encode_server_sort_request },
1258
 
        { "1.2.840.113556.1.4.474", decode_server_sort_response, encode_server_sort_response },
1259
 
        { "1.2.840.113556.1.4.1504", decode_asq_control, encode_asq_control },
1260
 
        { "1.2.840.113556.1.4.841", decode_dirsync_request, encode_dirsync_request },
1261
 
        { "1.2.840.113556.1.4.528", decode_notification_request, encode_notification_request },
1262
 
        { "1.2.840.113556.1.4.417", decode_show_deleted_request, encode_show_deleted_request },
1263
 
        { "1.2.840.113556.1.4.2064", decode_show_recycled_request, encode_show_recycled_request },
1264
 
        { "1.2.840.113556.1.4.2065", decode_show_deactivated_link_request, encode_show_deactivated_link_request },
1265
 
        { "1.2.840.113556.1.4.1413", decode_permissive_modify_request, encode_permissive_modify_request },
1266
 
        { "1.2.840.113556.1.4.801", decode_sd_flags_request, encode_sd_flags_request },
1267
 
        { "1.2.840.113556.1.4.1339", decode_domain_scope_request, encode_domain_scope_request },
1268
 
        { "1.2.840.113556.1.4.1340", decode_search_options_request, encode_search_options_request },
1269
 
        { "2.16.840.1.113730.3.4.2", decode_manageDSAIT_request, encode_manageDSAIT_request },
1270
 
        { "2.16.840.1.113730.3.4.9", decode_vlv_request, encode_vlv_request },
1271
 
        { "2.16.840.1.113730.3.4.10", decode_vlv_response, encode_vlv_response },
 
1140
        { LDB_CONTROL_PAGED_RESULTS_OID, decode_paged_results_request, encode_paged_results_request },
 
1141
        { LDB_CONTROL_SD_FLAGS_OID, decode_sd_flags_request, encode_sd_flags_request },
 
1142
        { LDB_CONTROL_DOMAIN_SCOPE_OID, decode_flag_request, encode_flag_request },
 
1143
        { LDB_CONTROL_SEARCH_OPTIONS_OID, decode_search_options_request, encode_search_options_request },
 
1144
        { LDB_CONTROL_NOTIFICATION_OID, decode_flag_request, encode_flag_request },
 
1145
        { LDB_CONTROL_TREE_DELETE_OID, decode_flag_request, encode_flag_request },
 
1146
        { LDB_CONTROL_SHOW_DELETED_OID, decode_flag_request, encode_flag_request },
 
1147
        { LDB_CONTROL_SHOW_RECYCLED_OID, decode_flag_request, encode_flag_request },
 
1148
        { LDB_CONTROL_SHOW_DEACTIVATED_LINK_OID, decode_flag_request, encode_flag_request },
 
1149
        { LDB_CONTROL_EXTENDED_DN_OID, decode_extended_dn_request, encode_extended_dn_request },
 
1150
        { LDB_CONTROL_SERVER_SORT_OID, decode_server_sort_request, encode_server_sort_request },
 
1151
        { LDB_CONTROL_SORT_RESP_OID, decode_server_sort_response, encode_server_sort_response },
 
1152
        { LDB_CONTROL_ASQ_OID, decode_asq_control, encode_asq_control },
 
1153
        { LDB_CONTROL_DIRSYNC_OID, decode_dirsync_request, encode_dirsync_request },
 
1154
        { LDB_CONTROL_VLV_REQ_OID, decode_vlv_request, encode_vlv_request },
 
1155
        { LDB_CONTROL_VLV_RESP_OID, decode_vlv_response, encode_vlv_response },
 
1156
        { LDB_CONTROL_PERMISSIVE_MODIFY_OID, decode_flag_request, encode_flag_request },
 
1157
        { LDB_CONTROL_SERVER_LAZY_COMMIT, decode_flag_request, encode_flag_request },
 
1158
        { LDB_CONTROL_RODC_DCPROMO_OID, decode_flag_request, encode_flag_request },
 
1159
        { LDB_CONTROL_RELAX_OID, decode_flag_request, encode_flag_request },
 
1160
        { DSDB_OPENLDAP_DEREFERENCE_CONTROL, decode_openldap_dereference, encode_openldap_dereference },
 
1161
 
1272
1162
/* DSDB_CONTROL_CURRENT_PARTITION_OID is internal only, and has no network representation */
1273
 
        { "1.3.6.1.4.1.7165.4.3.2", NULL, NULL },
 
1163
        { DSDB_CONTROL_CURRENT_PARTITION_OID, NULL, NULL },
 
1164
/* DSDB_CONTROL_REPLICATED_UPDATE_OID is internal only, and has no network representation */
 
1165
        { DSDB_CONTROL_REPLICATED_UPDATE_OID, NULL, NULL },
 
1166
/* DSDB_CONTROL_DN_STORAGE_FORMAT_OID is internal only, and has no network representation */
 
1167
        { DSDB_CONTROL_DN_STORAGE_FORMAT_OID, NULL, NULL },
 
1168
/* LDB_CONTROL_RECALCULATE_SD_OID is internal only, and has no network representation */
 
1169
        { LDB_CONTROL_RECALCULATE_SD_OID, NULL, NULL },
 
1170
/* LDB_CONTROL_REVEAL_INTERNALS is internal only, and has no network representation */
 
1171
        { LDB_CONTROL_REVEAL_INTERNALS, NULL, NULL },
 
1172
/* LDB_CONTROL_AS_SYSTEM_OID is internal only, and has no network representation */
 
1173
        { LDB_CONTROL_AS_SYSTEM_OID, NULL, NULL },
 
1174
/* DSDB_CONTROL_PASSWORD_CHANGE_STATUS_OID is internal only, and has no network representation */
 
1175
        { DSDB_CONTROL_PASSWORD_CHANGE_STATUS_OID, NULL, NULL },
 
1176
/* DSDB_CONTROL_PASSWORD_HASH_VALUES_OID is internal only, and has no network representation */
 
1177
        { DSDB_CONTROL_PASSWORD_HASH_VALUES_OID, NULL, NULL },
 
1178
/* DSDB_CONTROL_PASSWORD_CHANGE_OID is internal only, and has no network representation */
 
1179
        { DSDB_CONTROL_PASSWORD_CHANGE_OID, NULL, NULL },
 
1180
/* DSDB_CONTROL_APPLY_LINKS is internal only, and has no network representation */
 
1181
        { DSDB_CONTROL_APPLY_LINKS, NULL, NULL },
 
1182
/* DSDB_CONTROL_BYPASS_PASSWORD_HASH_OID is internal only, and has an empty network representation */
 
1183
        { DSDB_CONTROL_BYPASS_PASSWORD_HASH_OID, decode_flag_request, encode_flag_request },
 
1184
/* LDB_CONTROL_BYPASS_OPERATIONAL_OID is internal only, and has no network representation */
 
1185
        { LDB_CONTROL_BYPASS_OPERATIONAL_OID, NULL, NULL },
 
1186
/* DSDB_CONTROL_CHANGEREPLMETADATA_OID is internal only, and has no network representation */
 
1187
        { DSDB_CONTROL_CHANGEREPLMETADATA_OID, NULL, NULL },
 
1188
/* LDB_CONTROL_PROVISION_OID is internal only, and has no network representation */
 
1189
        { LDB_CONTROL_PROVISION_OID, NULL, NULL },
1274
1190
/* DSDB_EXTENDED_REPLICATED_OBJECTS_OID is internal only, and has no network representation */
1275
 
        { "1.3.6.1.4.1.7165.4.4.1", NULL, NULL },
1276
 
        { DSDB_OPENLDAP_DEREFERENCE_CONTROL, decode_openldap_dereference, encode_openldap_dereference},
 
1191
        { DSDB_EXTENDED_REPLICATED_OBJECTS_OID, NULL, NULL },
 
1192
/* DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID is internal only, and has no network representation */
 
1193
        { DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID, NULL, NULL },
 
1194
/* DSDB_EXTENDED_ALLOCATE_RID_POOL is internal only, and has no network representation */
 
1195
        { DSDB_EXTENDED_ALLOCATE_RID_POOL, NULL, NULL },
1277
1196
        { NULL, NULL, NULL }
1278
1197
};
1279
1198