~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source4/wrepl_server/wrepl_scavenging.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:
23
23
#include "librpc/gen_ndr/ndr_winsrepl.h"
24
24
#include "wrepl_server/wrepl_server.h"
25
25
#include "nbt_server/wins/winsdb.h"
26
 
#include "ldb/include/ldb.h"
27
 
#include "ldb/include/ldb_errors.h"
 
26
#include <ldb.h>
 
27
#include <ldb_errors.h>
28
28
#include "system/time.h"
29
29
#include "smbd/service_task.h"
30
30
#include "lib/messaging/irpc.h"
31
 
#include "librpc/gen_ndr/ndr_irpc.h"
 
31
#include "librpc/gen_ndr/ndr_irpc_c.h"
32
32
#include "librpc/gen_ndr/ndr_nbt.h"
33
33
#include "param/param.h"
34
34
 
52
52
        struct ldb_result *res = NULL;
53
53
        const char *owner_filter;
54
54
        const char *filter;
55
 
        uint32_t i;
 
55
        unsigned int i;
56
56
        int ret;
57
57
        time_t now = time(NULL);
58
58
        const char *now_timestr;
65
65
        bool delete_tombstones;
66
66
        struct timeval tombstone_extra_time;
67
67
        const char *local_owner = service->wins_db->local_owner;
68
 
        bool propagate = lp_parm_bool(service->task->lp_ctx, NULL, "wreplsrv", "propagate name releases", false);
 
68
        bool propagate = lpcfg_parm_bool(service->task->lp_ctx, NULL, "wreplsrv", "propagate name releases", false);
69
69
 
70
70
        now_timestr = ldb_timestring(tmp_mem, now);
71
71
        NT_STATUS_HAVE_NO_MEMORY(now_timestr);
206
206
        struct ldb_result *res = NULL;
207
207
        const char *owner_filter;
208
208
        const char *filter;
209
 
        uint32_t i;
 
209
        unsigned int i;
210
210
        int ret;
211
211
        time_t now = time(NULL);
212
212
        const char *now_timestr;
312
312
        struct nbtd_proxy_wins_challenge r;
313
313
};
314
314
 
315
 
static void verify_handler(struct irpc_request *ireq)
 
315
static void verify_handler(struct tevent_req *subreq)
316
316
{
317
 
        struct verify_state *s = talloc_get_type(ireq->async.private_data,
318
 
                                 struct verify_state);
 
317
        struct verify_state *s =
 
318
                tevent_req_callback_data(subreq,
 
319
                struct verify_state);
319
320
        struct winsdb_record *rec = s->rec;
320
321
        const char *action;
321
322
        const char *old_state = "active";
336
337
         *   - if they match do nothing
337
338
         * - if an error happens do nothing
338
339
         */
339
 
        status = irpc_call_recv(ireq);
 
340
        status = dcerpc_nbtd_proxy_wins_challenge_r_recv(subreq, s);
 
341
        TALLOC_FREE(subreq);
340
342
        if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) {
341
343
                delete_record = true;
342
344
                new_state = "deleted";
421
423
        struct ldb_result *res = NULL;
422
424
        const char *owner_filter;
423
425
        const char *filter;
424
 
        uint32_t i;
 
426
        unsigned int i;
425
427
        int ret;
426
428
        time_t now = time(NULL);
427
429
        const char *now_timestr;
428
 
        struct irpc_request *ireq;
 
430
        struct tevent_req *subreq;
429
431
        struct verify_state *s;
430
 
        struct server_id *nbt_servers;
431
 
 
432
 
        nbt_servers = irpc_servers_byname(service->task->msg_ctx, tmp_mem, "nbt_server");
433
 
        if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) {
434
 
                return NT_STATUS_INTERNAL_ERROR;
435
 
        }
 
432
        struct dcerpc_binding_handle *irpc_handle;
436
433
 
437
434
        now_timestr = ldb_timestring(tmp_mem, now);
438
435
        NT_STATUS_HAVE_NO_MEMORY(now_timestr);
489
486
                /* TODO: fix pidl to handle inline ipv4address arrays */
490
487
                s->r.in.addrs[0].addr   = rec->wins_owner;
491
488
 
492
 
                ireq = IRPC_CALL_SEND(s->msg_ctx, nbt_servers[0],
493
 
                                      irpc, NBTD_PROXY_WINS_CHALLENGE,
494
 
                                      &s->r, s);
495
 
                NT_STATUS_HAVE_NO_MEMORY(ireq);
496
 
 
497
 
                ireq->async.fn          = verify_handler;
498
 
                ireq->async.private_data= s;
 
489
                irpc_handle = irpc_binding_handle_by_name(s,
 
490
                                                          service->task->msg_ctx,
 
491
                                                          "nbt_server",
 
492
                                                          &ndr_table_irpc);
 
493
                if (irpc_handle == NULL) {
 
494
                        return NT_STATUS_INTERNAL_ERROR;
 
495
                }
 
496
 
 
497
                subreq = dcerpc_nbtd_proxy_wins_challenge_r_send(s,
 
498
                                                                 service->task->event_ctx,
 
499
                                                                 irpc_handle,
 
500
                                                                 &s->r);
 
501
                NT_STATUS_HAVE_NO_MEMORY(subreq);
 
502
 
 
503
                tevent_req_set_callback(subreq, verify_handler, s);
499
504
 
500
505
                talloc_steal(service, s);
501
506
        }