Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

Location:
vendor/current/source4/cldap_server
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/cldap_server/cldap_server.c

    r414 r740  
    2222#include "includes.h"
    2323#include <talloc.h>
    24 #include "libcli/ldap/ldap.h"
    2524#include "lib/messaging/irpc.h"
    2625#include "smbd/service_task.h"
     
    2928#include "system/network.h"
    3029#include "lib/socket/netif.h"
    31 #include "lib/ldb/include/ldb.h"
    32 #include "lib/ldb/include/ldb_errors.h"
     30#include <ldb.h>
     31#include <ldb_errors.h>
    3332#include "dsdb/samdb/samdb.h"
    3433#include "ldb_wrap.h"
     
    113112                                                "ip",
    114113                                                address,
    115                                                 lp_cldap_port(lp_ctx),
     114                                                lpcfg_cldap_port(lp_ctx),
    116115                                                &socket_address);
    117116        if (ret != 0) {
    118117                status = map_nt_error_from_unix(errno);
    119118                DEBUG(0,("invalid address %s:%d - %s:%s\n",
    120                          address, lp_cldap_port(lp_ctx),
     119                         address, lpcfg_cldap_port(lp_ctx),
    121120                         gai_strerror(ret), nt_errstr(status)));
    122121                return status;
     
    149148                                          struct interface *ifaces)
    150149{
    151         int num_interfaces;
     150        int i, num_interfaces;
    152151        TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
    153152        NTSTATUS status;
    154         int i;
    155153
    156154        num_interfaces = iface_count(ifaces);
     
    158156        /* if we are allowing incoming packets from any address, then
    159157           we need to bind to the wildcard address */
    160         if (!lp_bind_interfaces_only(lp_ctx)) {
     158        if (!lpcfg_bind_interfaces_only(lp_ctx)) {
    161159                status = cldapd_add_socket(cldapd, lp_ctx, "0.0.0.0");
    162160                NT_STATUS_NOT_OK_RETURN(status);
     
    185183        struct interface *ifaces;
    186184       
    187         load_interfaces(task, lp_interfaces(task->lp_ctx), &ifaces);
     185        load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
    188186
    189187        if (iface_count(ifaces) == 0) {
     
    192190        }
    193191
    194         switch (lp_server_role(task->lp_ctx)) {
     192        switch (lpcfg_server_role(task->lp_ctx)) {
    195193        case ROLE_STANDALONE:
    196194                task_server_terminate(task, "cldap_server: no CLDAP server required in standalone configuration",
     
    215213
    216214        cldapd->task = task;
    217         cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, system_session(cldapd, task->lp_ctx));
     215        cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, system_session(task->lp_ctx), 0);
    218216        if (cldapd->samctx == NULL) {
    219217                task_server_terminate(task, "cldapd failed to open samdb", true);
  • vendor/current/source4/cldap_server/cldap_server.h

    r414 r740  
    2121
    2222#include "libcli/cldap/cldap.h"
     23#include "libcli/ldap/libcli_ldap.h"
    2324
    2425/*
     
    3233struct ldap_SearchRequest;
    3334
     35/* used by netlogon DCE/RPC server */
     36NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
     37                                         TALLOC_CTX *mem_ctx,
     38                                         const char *domain,
     39                                         const char *netbios_domain,
     40                                         struct dom_sid *domain_sid,
     41                                         const char *domain_guid,
     42                                         const char *user,
     43                                         uint32_t acct_control,
     44                                         const char *src_address,
     45                                         uint32_t version,
     46                                         struct loadparm_context *lp_ctx,
     47                                         struct netlogon_samlogon_response *netlogon,
     48                                         bool fill_on_blank_request);
     49
    3450#include "cldap_server/proto.h"
  • vendor/current/source4/cldap_server/netlogon.c

    r414 r740  
    2222
    2323#include "includes.h"
    24 #include "lib/ldb/include/ldb.h"
    25 #include "lib/ldb/include/ldb_errors.h"
     24#include <ldb.h>
     25#include <ldb_errors.h>
    2626#include "lib/events/events.h"
    2727#include "smbd/service_task.h"
     
    3737#include "param/param.h"
    3838#include "../lib/tsocket/tsocket.h"
     39#include "libds/common/flag_mapping.h"
    3940
    4041/*
     
    5253                                         uint32_t version,
    5354                                         struct loadparm_context *lp_ctx,
    54                                          struct netlogon_samlogon_response *netlogon)
     55                                         struct netlogon_samlogon_response *netlogon,
     56                                         bool fill_on_blank_request)
    5557{
    5658        const char *dom_attrs[] = {"objectGUID", NULL};
     
    5860        struct ldb_result *dom_res = NULL, *user_res = NULL;
    5961        int ret;
    60         const char **services = lp_server_services(lp_ctx);
     62        const char **services = lpcfg_server_services(lp_ctx);
    6163        uint32_t server_type;
    6264        const char *pdc_name;
    6365        struct GUID domain_uuid;
    64         const char *realm;
    6566        const char *dns_domain;
     67        const char *forest_domain;
    6668        const char *pdc_dns_name;
    6769        const char *flatname;
     
    7173        struct ldb_dn *domain_dn = NULL;
    7274        struct interface *ifaces;
    73         bool user_known;
     75        bool user_known, am_rodc;
    7476        NTSTATUS status;
    7577
    76         /* the domain has an optional trailing . */
     78        /* the domain parameter could have an optional trailing "." */
    7779        if (domain && domain[strlen(domain)-1] == '.') {
    7880                domain = talloc_strndup(mem_ctx, domain, strlen(domain)-1);
    79         }
    80 
    81         if (domain && strcasecmp_m(domain, lp_realm(lp_ctx)) == 0) {
     81                NT_STATUS_HAVE_NO_MEMORY(domain);
     82        }
     83
     84        /* Lookup using long or short domainname */
     85        if (domain && (strcasecmp_m(domain, lpcfg_dnsdomain(lp_ctx)) == 0)) {
    8286                domain_dn = ldb_get_default_basedn(sam_ctx);
    8387        }
    84 
    85         if (netbios_domain && strcasecmp_m(domain, lp_sam_name(lp_ctx))) {
     88        if (netbios_domain && (strcasecmp_m(netbios_domain, lpcfg_sam_name(lp_ctx)) == 0)) {
    8689                domain_dn = ldb_get_default_basedn(sam_ctx);
    8790        }
    88 
    8991        if (domain_dn) {
     92                const char *domain_identifier = domain != NULL ? domain
     93                                                        : netbios_domain;
    9094                ret = ldb_search(sam_ctx, mem_ctx, &dom_res,
    9195                                 domain_dn, LDB_SCOPE_BASE, dom_attrs,
    9296                                 "objectClass=domain");
    9397                if (ret != LDB_SUCCESS) {
    94                         DEBUG(2,("Error finding domain '%s'/'%s' in sam: %s\n", domain, ldb_dn_get_linearized(domain_dn), ldb_errstring(sam_ctx)));
     98                        DEBUG(2,("Error finding domain '%s'/'%s' in sam: %s\n",
     99                                 domain_identifier,
     100                                 ldb_dn_get_linearized(domain_dn),
     101                                 ldb_errstring(sam_ctx)));
    95102                        return NT_STATUS_NO_SUCH_DOMAIN;
    96103                }
    97104                if (dom_res->count != 1) {
    98                         DEBUG(2,("Error finding domain '%s'/'%s' in sam\n", domain, ldb_dn_get_linearized(domain_dn)));
     105                        DEBUG(2,("Error finding domain '%s'/'%s' in sam\n",
     106                                 domain_identifier,
     107                                 ldb_dn_get_linearized(domain_dn)));
    99108                        return NT_STATUS_NO_SUCH_DOMAIN;
    100109                }
    101110        }
    102111
    103         if ((dom_res == NULL || dom_res->count == 0) && (domain_guid || domain_sid)) {
    104 
     112        /* Lookup using GUID or SID */
     113        if ((dom_res == NULL) && (domain_guid || domain_sid)) {
    105114                if (domain_guid) {
    106115                        struct GUID binary_guid;
    107116                        struct ldb_val guid_val;
    108                         enum ndr_err_code ndr_err;
    109117
    110118                        /* By this means, we ensure we don't have funny stuff in the GUID */
     
    116124
    117125                        /* And this gets the result into the binary format we want anyway */
    118                         ndr_err = ndr_push_struct_blob(&guid_val, mem_ctx, NULL, &binary_guid,
    119                                                        (ndr_push_flags_fn_t)ndr_push_GUID);
    120                         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
    121                                 return NT_STATUS_INVALID_PARAMETER;
     126                        status = GUID_to_ndr_blob(&binary_guid, mem_ctx, &guid_val);
     127                        if (!NT_STATUS_IS_OK(status)) {
     128                                return status;
    122129                        }
    123130                        ret = ldb_search(sam_ctx, mem_ctx, &dom_res,
     
    132139                       
    133140                        /* Rather than go via the string, just push into the NDR form */
    134                         ndr_err = ndr_push_struct_blob(&sid_val, mem_ctx, NULL, &sid,
     141                        ndr_err = ndr_push_struct_blob(&sid_val, mem_ctx, &sid,
    135142                                                       (ndr_push_flags_fn_t)ndr_push_dom_sid);
    136143                        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    141148                                                 NULL, LDB_SCOPE_SUBTREE,
    142149                                                 dom_attrs,
    143                                                  "(&(objectCategory=DomainDNS)(objectSID=%s))",
     150                                                 "(&(objectCategory=DomainDNS)(objectSid=%s))",
    144151                                                 ldb_binary_encode(mem_ctx, sid_val));
    145152                }
    146153               
    147154                if (ret != LDB_SUCCESS) {
    148                         DEBUG(2,("Unable to find referece to GUID '%s' or SID %s in sam: %s\n",
     155                        DEBUG(2,("Unable to find a correct reference to GUID '%s' or SID '%s' in sam: %s\n",
    149156                                 domain_guid, dom_sid_string(mem_ctx, domain_sid),
    150157                                 ldb_errstring(sam_ctx)));
     
    152159                } else if (dom_res->count == 1) {
    153160                        /* Ok, now just check it is our domain */
    154                        
    155                         if (ldb_dn_compare(ldb_get_default_basedn(sam_ctx), dom_res->msgs[0]->dn) != 0) {
     161                        if (ldb_dn_compare(ldb_get_default_basedn(sam_ctx),
     162                                           dom_res->msgs[0]->dn) != 0) {
     163                                DEBUG(2,("The GUID '%s' or SID '%s' doesn't identify our domain\n",
     164                                         domain_guid,
     165                                         dom_sid_string(mem_ctx, domain_sid)));
    156166                                return NT_STATUS_NO_SUCH_DOMAIN;
    157167                        }
    158                 } else if (dom_res->count > 1) {
     168                } else {
     169                        DEBUG(2,("Unable to find a correct reference to GUID '%s' or SID '%s' in sam\n",
     170                                 domain_guid, dom_sid_string(mem_ctx, domain_sid)));
    159171                        return NT_STATUS_NO_SUCH_DOMAIN;
    160172                }
    161173        }
    162174
    163 
    164         if ((dom_res == NULL || dom_res->count == 0)) {
    165                 DEBUG(2,("Unable to find domain with name %s or GUID {%s}\n", domain, domain_guid));
     175        if (dom_res == NULL && fill_on_blank_request) {
     176                /* blank inputs gives our domain - tested against
     177                   w2k8r2. Without this ADUC on Win7 won't start */
     178                domain_dn = ldb_get_default_basedn(sam_ctx);
     179                ret = ldb_search(sam_ctx, mem_ctx, &dom_res,
     180                                 domain_dn, LDB_SCOPE_BASE, dom_attrs,
     181                                 "objectClass=domain");
     182                if (ret != LDB_SUCCESS) {
     183                        DEBUG(2,("Error finding domain '%s'/'%s' in sam: %s\n",
     184                                 lpcfg_dnsdomain(lp_ctx),
     185                                 ldb_dn_get_linearized(domain_dn),
     186                                 ldb_errstring(sam_ctx)));
     187                        return NT_STATUS_NO_SUCH_DOMAIN;
     188                }
     189        }
     190
     191        if (dom_res == NULL) {
     192                DEBUG(2,(__location__ ": Unable to get domain information with no inputs\n"));
    166193                return NT_STATUS_NO_SUCH_DOMAIN;
    167194        }
     
    192219                                         UF_ACCOUNTDISABLE, ds_acb2uf(acct_control));
    193220                if (ret != LDB_SUCCESS) {
    194                         DEBUG(2,("Unable to find referece to user '%s' with ACB 0x%8x under %s: %s\n",
     221                        DEBUG(2,("Unable to find reference to user '%s' with ACB 0x%8x under %s: %s\n",
    195222                                 user, acct_control, ldb_dn_get_linearized(dom_res->msgs[0]->dn),
    196223                                 ldb_errstring(sam_ctx)));
     
    207234               
    208235        server_type      =
    209                 NBT_SERVER_DS | NBT_SERVER_TIMESERV |
    210                 NBT_SERVER_CLOSEST | NBT_SERVER_WRITABLE |
    211                 NBT_SERVER_GOOD_TIMESERV | DS_DNS_CONTROLLER |
    212                 DS_DNS_DOMAIN;
     236                DS_SERVER_DS | DS_SERVER_TIMESERV |
     237                DS_SERVER_CLOSEST |
     238                DS_SERVER_GOOD_TIMESERV;
     239
     240#if 0
     241        /* w2k8-r2 as a DC does not claim these */
     242        server_type |= DS_DNS_CONTROLLER | DS_DNS_DOMAIN;
     243#endif
    213244
    214245        if (samdb_is_pdc(sam_ctx)) {
    215                 int *domainFunctionality;
    216                 server_type |= NBT_SERVER_PDC;
    217                 domainFunctionality = talloc_get_type(ldb_get_opaque(sam_ctx, "domainFunctionality"), int);
    218                 if (domainFunctionality && *domainFunctionality >= DS_DOMAIN_FUNCTION_2008) {
    219                         server_type |= NBT_SERVER_FULL_SECRET_DOMAIN_6;
    220                 }
     246                server_type |= DS_SERVER_PDC;
     247        }
     248
     249        if (dsdb_functional_level(sam_ctx) >= DS_DOMAIN_FUNCTION_2008) {
     250                server_type |= DS_SERVER_FULL_SECRET_DOMAIN_6;
    221251        }
    222252
    223253        if (samdb_is_gc(sam_ctx)) {
    224                 server_type |= NBT_SERVER_GC;
     254                server_type |= DS_SERVER_GC;
    225255        }
    226256
    227257        if (str_list_check(services, "ldap")) {
    228                 server_type |= NBT_SERVER_LDAP;
     258                server_type |= DS_SERVER_LDAP;
    229259        }
    230260
    231261        if (str_list_check(services, "kdc")) {
    232                 server_type |= NBT_SERVER_KDC;
    233         }
    234 
     262                server_type |= DS_SERVER_KDC;
     263        }
     264
     265        if (samdb_rodc(sam_ctx, &am_rodc) == LDB_SUCCESS && !am_rodc) {
     266                server_type |= DS_SERVER_WRITABLE;
     267        }
     268
     269#if 0
     270        /* w2k8-r2 as a sole DC does not claim this */
    235271        if (ldb_dn_compare(ldb_get_root_basedn(sam_ctx), ldb_get_default_basedn(sam_ctx)) == 0) {
    236                 server_type |= DS_DNS_FOREST;
    237         }
    238 
    239         pdc_name         = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name(lp_ctx));
     272                server_type |= DS_DNS_FOREST_ROOT;
     273        }
     274#endif
     275
     276        pdc_name         = talloc_asprintf(mem_ctx, "\\\\%s",
     277                                           lpcfg_netbios_name(lp_ctx));
     278        NT_STATUS_HAVE_NO_MEMORY(pdc_name);
    240279        domain_uuid      = samdb_result_guid(dom_res->msgs[0], "objectGUID");
    241         realm            = lp_realm(lp_ctx);
    242         dns_domain       = lp_realm(lp_ctx);
     280        dns_domain       = lpcfg_dnsdomain(lp_ctx);
     281        forest_domain    = samdb_forest_name(sam_ctx, mem_ctx);
     282        NT_STATUS_HAVE_NO_MEMORY(forest_domain);
    243283        pdc_dns_name     = talloc_asprintf(mem_ctx, "%s.%s",
    244284                                           strlower_talloc(mem_ctx,
    245                                                            lp_netbios_name(lp_ctx)),
     285                                                           lpcfg_netbios_name(lp_ctx)),
    246286                                           dns_domain);
    247 
    248         flatname         = lp_sam_name(lp_ctx);
    249         /* FIXME: Hardcoded site names */
    250         server_site      = "Default-First-Site-Name";
    251         client_site      = "Default-First-Site-Name";
    252         load_interfaces(mem_ctx, lp_interfaces(lp_ctx), &ifaces);
    253         pdc_ip           = iface_best_ip(ifaces, src_address);
    254 
     287        NT_STATUS_HAVE_NO_MEMORY(pdc_dns_name);
     288        flatname         = lpcfg_workgroup(lp_ctx);
     289        server_site      = samdb_server_site_name(sam_ctx, mem_ctx);
     290        NT_STATUS_HAVE_NO_MEMORY(server_site);
     291        client_site      = samdb_client_site_name(sam_ctx, mem_ctx,
     292                                                  src_address, NULL);
     293        NT_STATUS_HAVE_NO_MEMORY(client_site);
     294        load_interfaces(mem_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
     295        /*
     296         * TODO: the caller should pass the address which the client
     297         * used to trigger this call, as the client is able to reach
     298         * this ip.
     299         */
     300        if (src_address) {
     301                pdc_ip = iface_best_ip(ifaces, src_address);
     302        } else {
     303                pdc_ip = iface_n_ip(ifaces, 0);
     304        }
    255305        ZERO_STRUCTP(netlogon);
    256306
     
    266316                        netlogon->data.nt5_ex.command      = LOGON_SAM_LOGON_USER_UNKNOWN_EX;
    267317                }
    268                 netlogon->data.nt5_ex.server_type  = server_type;
     318                netlogon->data.nt5_ex.pdc_name     = pdc_name;
     319                netlogon->data.nt5_ex.user_name    = user;
     320                netlogon->data.nt5_ex.domain_name  = flatname;
    269321                netlogon->data.nt5_ex.domain_uuid  = domain_uuid;
    270                 netlogon->data.nt5_ex.forest       = realm;
     322                netlogon->data.nt5_ex.forest       = forest_domain;
    271323                netlogon->data.nt5_ex.dns_domain   = dns_domain;
    272324                netlogon->data.nt5_ex.pdc_dns_name = pdc_dns_name;
    273                 netlogon->data.nt5_ex.domain       = flatname;
    274                 netlogon->data.nt5_ex.pdc_name     = lp_netbios_name(lp_ctx);
    275                 netlogon->data.nt5_ex.user_name    = user;
    276325                netlogon->data.nt5_ex.server_site  = server_site;
    277326                netlogon->data.nt5_ex.client_site  = client_site;
    278 
    279327                if (version & NETLOGON_NT_VERSION_5EX_WITH_IP) {
    280328                        /* Clearly this needs to be fixed up for IPv6 */
     
    284332                        netlogon->data.nt5_ex.sockaddr.remaining = data_blob_talloc_zero(mem_ctx, 8);
    285333                }
     334                netlogon->data.nt5_ex.server_type  = server_type;
    286335                netlogon->data.nt5_ex.nt_version   = NETLOGON_NT_VERSION_1|NETLOGON_NT_VERSION_5EX|extra_flags;
    287336                netlogon->data.nt5_ex.lmnt_token   = 0xFFFF;
     
    301350                netlogon->data.nt5.domain_name  = flatname;
    302351                netlogon->data.nt5.domain_uuid  = domain_uuid;
    303                 netlogon->data.nt5.forest       = realm;
     352                netlogon->data.nt5.forest       = forest_domain;
    304353                netlogon->data.nt5.dns_domain   = dns_domain;
    305354                netlogon->data.nt5.pdc_dns_name = pdc_dns_name;
     
    318367                        netlogon->data.nt4.command      = LOGON_SAM_LOGON_USER_UNKNOWN;
    319368                }
    320                 netlogon->data.nt4.server      = pdc_name;
     369                netlogon->data.nt4.pdc_name    = pdc_name;
    321370                netlogon->data.nt4.user_name   = user;
    322                 netlogon->data.nt4.domain      = flatname;
     371                netlogon->data.nt4.domain_name = flatname;
    323372                netlogon->data.nt4.nt_version  = NETLOGON_NT_VERSION_1;
    324373                netlogon->data.nt4.lmnt_token  = 0xFFFF;
     
    340389                             struct tsocket_address *src)
    341390{
    342         int i;
     391        unsigned int i;
    343392        const char *domain = NULL;
    344393        const char *host = NULL;
    345394        const char *user = NULL;
    346395        const char *domain_guid = NULL;
    347         const char *domain_sid = NULL;
     396        struct dom_sid *domain_sid = NULL;
    348397        int acct_control = -1;
    349398        int version = -1;
     
    377426                }
    378427                if (strcasecmp(t->u.equality.attr, "DomainSid") == 0) {
    379                         domain_sid = talloc_strndup(tmp_ctx,
    380                                                     (const char *)t->u.equality.value.data,
    381                                                     t->u.equality.value.length);
     428                        enum ndr_err_code ndr_err;
     429
     430                        domain_sid = talloc(tmp_ctx, struct dom_sid);
     431                        if (domain_sid == NULL) {
     432                                goto failed;
     433                        }
     434                        ndr_err = ndr_pull_struct_blob(&t->u.equality.value,
     435                                                       domain_sid, domain_sid,
     436                                                       (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
     437                        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     438                                talloc_free(domain_sid);
     439                                goto failed;
     440                        }
    382441                }
    383442                if (strcasecmp(t->u.equality.attr, "User") == 0) {
     
    396455        }
    397456
    398         if (domain_guid == NULL && domain == NULL) {
    399                 domain = lp_realm(cldapd->task->lp_ctx);
     457        if ((domain == NULL) && (domain_guid == NULL) && (domain_sid == NULL)) {
     458                domain = lpcfg_dnsdomain(cldapd->task->lp_ctx);
    400459        }
    401460
     
    407466                 domain, host, user, version, domain_guid));
    408467
    409         status = fill_netlogon_samlogon_response(cldapd->samctx, tmp_ctx, domain, NULL, NULL, domain_guid,
     468        status = fill_netlogon_samlogon_response(cldapd->samctx, tmp_ctx,
     469                                                 domain, NULL, domain_sid,
     470                                                 domain_guid,
    410471                                                 user, acct_control,
    411472                                                 tsocket_address_inet_addr_string(src, tmp_ctx),
    412                                                  version, cldapd->task->lp_ctx, &netlogon);
     473                                                 version, cldapd->task->lp_ctx,
     474                                                 &netlogon, false);
    413475        if (!NT_STATUS_IS_OK(status)) {
    414476                goto failed;
    415477        }
    416478
    417         status = cldap_netlogon_reply(cldap,
    418                                       lp_iconv_convenience(cldapd->task->lp_ctx),
    419                                       message_id, src, version,
    420                                       &netlogon);
     479        status = cldap_netlogon_reply(cldap, message_id, src, version, &netlogon);
    421480        if (!NT_STATUS_IS_OK(status)) {
    422481                goto failed;
  • vendor/current/source4/cldap_server/rootdse.c

    r414 r740  
    2222#include "includes.h"
    2323#include <tevent.h>
    24 #include "libcli/ldap/ldap.h"
    25 #include "lib/ldb/include/ldb.h"
    26 #include "lib/ldb/include/ldb_errors.h"
     24#include <ldb.h>
     25#include <ldb_errors.h>
    2726#include "smbd/service_task.h"
    2827#include "cldap_server/cldap_server.h"
     
    3837{
    3938        struct ldap_SearchResEntry *ent = NULL;
    40         struct ldb_dn *basedn;
    4139        struct ldb_result *res = NULL;
    4240        struct ldb_request *lreq;
    43         enum ldb_scope scope = LDB_SCOPE_DEFAULT;
    4441        const char **attrs = NULL;
    4542        const char *errstr = NULL;
    46         int ret = 0;
    47         int ldb_ret = -1;
    48 
    49         basedn = ldb_dn_new(mem_ctx, cldapd->samctx, NULL);
    50         if (basedn == NULL) goto nomem;
    51         scope = LDB_SCOPE_BASE;
     43        int ret = LDAP_SUCCESS, ldb_ret;
    5244
    5345        if (search->num_attributes >= 1) {
     
    6759
    6860        ldb_ret = ldb_build_search_req_ex(&lreq, cldapd->samctx, mem_ctx,
    69                                           basedn, scope,
     61                                          NULL, LDB_SCOPE_BASE,
    7062                                          search->tree, attrs,
    7163                                          NULL,
     
    108100                }
    109101                ent->num_attributes = res->msgs[0]->num_elements;
    110                 ent->attributes = talloc_array(ent, struct ldb_message_element, ent->num_attributes);
     102                ent->attributes = talloc_array(ent, struct ldb_message_element,
     103                                               ent->num_attributes);
    111104                if (ent->attributes == NULL) goto nomem;
    112105                for (j=0; j < ent->num_attributes; j++) {
    113                         ent->attributes[j].name = talloc_steal(ent->attributes, res->msgs[0]->elements[j].name);
     106                        ent->attributes[j].name = talloc_steal(ent->attributes,
     107                                                               res->msgs[0]->elements[j].name);
    114108                        ent->attributes[j].num_values = 0;
    115109                        ent->attributes[j].values = NULL;
     
    124118
    125119reply:
    126         if (ret) {
     120        if (ret != LDAP_SUCCESS) {
    127121                /* nothing ... */
    128122        } else if (ldb_ret == LDB_SUCCESS) {
     
    165159        reply.result            = &result;
    166160
    167         cldapd_rootdse_fill(cldapd, tmp_ctx, search, &reply.response, reply.result);
     161        cldapd_rootdse_fill(cldapd, tmp_ctx, search, &reply.response,
     162                            reply.result);
    168163
    169164        status = cldap_reply_send(cldap, &reply);
Note: See TracChangeset for help on using the changeset viewer.