~ubuntu-branches/ubuntu/precise/samba/precise

« back to all changes in this revision

Viewing changes to source3/lib/messages.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:
46
46
*/
47
47
 
48
48
#include "includes.h"
49
 
#include "librpc/gen_ndr/messaging.h"
50
 
#include "librpc/gen_ndr/ndr_messaging.h"
 
49
#include "dbwrap.h"
 
50
#include "serverid.h"
 
51
#include "messages.h"
51
52
 
52
53
struct messaging_callback {
53
54
        struct messaging_callback *prev, *next;
95
96
 Send one of the messages for the broadcast.
96
97
****************************************************************************/
97
98
 
98
 
static int traverse_fn(struct db_record *rec,
99
 
                       const struct connections_key *ckey,
100
 
                       const struct connections_data *crec,
101
 
                       void *state)
 
99
static int traverse_fn(struct db_record *rec, const struct server_id *id,
 
100
                       uint32_t msg_flags, void *state)
102
101
{
103
102
        struct msg_all *msg_all = (struct msg_all *)state;
104
103
        NTSTATUS status;
105
104
 
106
 
        if (crec->cnum != -1)
107
 
                return 0;
108
 
 
109
105
        /* Don't send if the receiver hasn't registered an interest. */
110
106
 
111
 
        if(!(crec->bcast_msg_flags & msg_all->msg_flag))
 
107
        if((msg_flags & msg_all->msg_flag) == 0) {
112
108
                return 0;
 
109
        }
113
110
 
114
111
        /* If the msg send fails because the pid was not found (i.e. smbd died), 
115
112
         * the msg has already been deleted from the messages.tdb.*/
116
113
 
117
 
        status = messaging_send_buf(msg_all->msg_ctx,
118
 
                                    crec->pid, msg_all->msg_type,
 
114
        status = messaging_send_buf(msg_all->msg_ctx, *id, msg_all->msg_type,
119
115
                                    (uint8 *)msg_all->buf, msg_all->len);
120
116
 
121
117
        if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
122
118
                
123
119
                /* If the pid was not found delete the entry from connections.tdb */
124
120
 
125
 
                DEBUG(2,("pid %s doesn't exist - deleting connections %d [%s]\n",
126
 
                         procid_str_static(&crec->pid), crec->cnum,
127
 
                         crec->servicename));
 
121
                DEBUG(2, ("pid %s doesn't exist\n", procid_str_static(id)));
128
122
 
129
123
                rec->delete_rec(rec);
130
124
        }
172
166
        msg_all.n_sent = 0;
173
167
        msg_all.msg_ctx = msg_ctx;
174
168
 
175
 
        connections_forall(traverse_fn, &msg_all);
 
169
        serverid_traverse(traverse_fn, &msg_all);
176
170
        if (n_sent)
177
171
                *n_sent = msg_all.n_sent;
178
172
        return True;
200
194
        status = messaging_tdb_init(ctx, ctx, &ctx->local);
201
195
 
202
196
        if (!NT_STATUS_IS_OK(status)) {
203
 
                DEBUG(0, ("messaging_tdb_init failed: %s\n",
 
197
                DEBUG(2, ("messaging_tdb_init failed: %s\n",
204
198
                          nt_errstr(status)));
205
199
                TALLOC_FREE(ctx);
206
200
                return NULL;
211
205
                status = messaging_ctdbd_init(ctx, ctx, &ctx->remote);
212
206
 
213
207
                if (!NT_STATUS_IS_OK(status)) {
214
 
                        DEBUG(1, ("messaging_ctdb_init failed: %s\n",
 
208
                        DEBUG(2, ("messaging_ctdb_init failed: %s\n",
215
209
                                  nt_errstr(status)));
216
210
                        TALLOC_FREE(ctx);
217
211
                        return NULL;
218
212
                }
219
213
        }
 
214
        ctx->id.vnn = get_my_vnn();
220
215
#endif
221
216
 
222
217
        messaging_register(ctx, NULL, MSG_PING, ping_message);
230
225
        return ctx;
231
226
}
232
227
 
 
228
struct server_id messaging_server_id(const struct messaging_context *msg_ctx)
 
229
{
 
230
        return msg_ctx->id;
 
231
}
 
232
 
233
233
/*
234
234
 * re-init after a fork
235
235
 */
236
 
NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
 
236
NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
 
237
                          struct server_id id)
237
238
{
238
239
        NTSTATUS status;
239
240
 
240
241
        TALLOC_FREE(msg_ctx->local);
241
242
 
 
243
        msg_ctx->id = id;
 
244
 
242
245
        status = messaging_tdb_init(msg_ctx, msg_ctx, &msg_ctx->local);
243
246
        if (!NT_STATUS_IS_OK(status)) {
244
247
                DEBUG(0, ("messaging_tdb_init failed: %s\n",
360
363
}
361
364
 
362
365
/*
363
 
  Dispatch one messsaging_rec
 
366
  Dispatch one messaging_rec
364
367
*/
365
368
void messaging_dispatch_rec(struct messaging_context *msg_ctx,
366
369
                            struct messaging_rec *rec)