~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source4/smbd/process_prefork.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:
25
25
 
26
26
#include "includes.h"
27
27
#include "lib/events/events.h"
28
 
#include "../tdb/include/tdb.h"
29
28
#include "lib/socket/socket.h"
30
29
#include "smbd/process_model.h"
31
 
#include "param/secrets.h"
32
30
#include "system/filesys.h"
33
31
#include "cluster/cluster.h"
34
32
#include "param/param.h"
 
33
#include "ldb_wrap.h"
35
34
 
36
35
#ifdef HAVE_SETPROCTITLE
37
36
#ifdef HAVE_SETPROCTITLE_H
49
48
/*
50
49
  called when the process model is selected
51
50
*/
52
 
static void prefork_model_init(struct tevent_context *ev)
 
51
static void prefork_model_init(void)
53
52
{
54
53
        signal(SIGCHLD, SIG_IGN);
55
54
}
56
55
 
57
56
static void prefork_reload_after_fork(void)
58
57
{
59
 
        /* tdb needs special fork handling */
60
 
        if (tdb_reopen_all(1) == -1) {
61
 
                DEBUG(0,("prefork_reload_after_fork: tdb_reopen_all failed.\n"));
62
 
        }
 
58
        ldb_wrap_fork_hook();
63
59
 
64
60
        /* Ensure that the forked children do not expose identical random streams */
65
61
        set_need_random_reseed();
97
93
static void prefork_new_task(struct tevent_context *ev, 
98
94
                             struct loadparm_context *lp_ctx,
99
95
                             const char *service_name,
100
 
                             void (*new_task_fn)(struct tevent_context *, struct loadparm_context *lp_ctx, struct server_id , void *), 
 
96
                             void (*new_task_fn)(struct tevent_context *, struct loadparm_context *lp_ctx, struct server_id , void *),
101
97
                             void *private_data)
102
98
{
103
99
        pid_t pid;
126
122
           is not associated with this new connection */
127
123
        talloc_free(ev);
128
124
 
129
 
        setproctitle("task %s server_id[%d]", service_name, pid);
 
125
        setproctitle("task %s server_id[%d]", service_name, (int)pid);
130
126
 
131
127
        prefork_reload_after_fork();
132
128
 
133
129
        /* setup this new connection: process will bind to it's sockets etc */
134
130
        new_task_fn(ev2, lp_ctx, cluster_id(pid, 0), private_data);
135
131
 
136
 
        num_children = lp_parm_int(lp_ctx, NULL, "prefork children", service_name, 0);
 
132
        num_children = lpcfg_parm_int(lp_ctx, NULL, "prefork children", service_name, 0);
137
133
        if (num_children == 0) {
138
134
 
139
135
                /* We don't want any kids hanging around for this one,
155
151
                        return;
156
152
                } else {
157
153
                        pid = getpid();
158
 
                        setproctitle("task %s server_id[%d]", service_name, pid);
 
154
                        setproctitle("task %s server_id[%d]", service_name, (int)pid);
159
155
 
160
156
                        prefork_reload_after_fork();
161
157
 
174
170
        
175
171
        /* But we need a events system to handle reaping children */
176
172
        ev_parent = s4_event_context_init(NULL);
177
 
        
 
173
 
178
174
        /* TODO: Handle some events... */
179
175
        
180
176
        /* we can't return to the top level here, as that event context is gone,
189
185
 
190
186
 
191
187
/* called when a task goes down */
192
 
_NORETURN_ static void prefork_terminate(struct tevent_context *ev, struct loadparm_context *lp_ctx, const char *reason) 
 
188
static void prefork_terminate(struct tevent_context *ev, struct loadparm_context *lp_ctx, const char *reason)
193
189
{
194
190
        DEBUG(2,("prefork_terminate: reason[%s]\n",reason));
195
191
}