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

« back to all changes in this revision

Viewing changes to libcli/cldap/cldap.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:
167
167
        c->recv_subreq = NULL;
168
168
}
169
169
 
170
 
static void cldap_socket_recv_dgram(struct cldap_socket *c,
 
170
static bool cldap_socket_recv_dgram(struct cldap_socket *c,
171
171
                                    struct cldap_incoming *in);
172
172
 
173
173
static void cldap_recvfrom_done(struct tevent_req *subreq)
176
176
                                 struct cldap_socket);
177
177
        struct cldap_incoming *in = NULL;
178
178
        ssize_t ret;
 
179
        bool setup_done;
179
180
 
180
181
        c->recv_subreq = NULL;
181
182
 
199
200
        }
200
201
 
201
202
        /* this function should free or steal 'in' */
202
 
        cldap_socket_recv_dgram(c, in);
 
203
        setup_done = cldap_socket_recv_dgram(c, in);
203
204
        in = NULL;
204
205
 
205
 
        if (!cldap_recvfrom_setup(c)) {
 
206
        if (!setup_done && !cldap_recvfrom_setup(c)) {
206
207
                goto nomem;
207
208
        }
208
209
 
218
219
/*
219
220
  handle recv events on a cldap socket
220
221
*/
221
 
static void cldap_socket_recv_dgram(struct cldap_socket *c,
 
222
static bool cldap_socket_recv_dgram(struct cldap_socket *c,
222
223
                                    struct cldap_incoming *in)
223
224
{
224
225
        DATA_BLOB blob;
262
263
 
263
264
                /* this function should free or steal 'in' */
264
265
                c->incoming.handler(c, c->incoming.private_data, in);
265
 
                return;
 
266
                return false;
266
267
        }
267
268
 
268
269
        search = talloc_get_type(p, struct cldap_search_state);
270
271
        search->response.asn1 = asn1;
271
272
        search->response.asn1->ofs = 0;
272
273
 
 
274
        DLIST_REMOVE(c->searches.list, search);
 
275
 
 
276
        if (!cldap_recvfrom_setup(c)) {
 
277
                goto nomem;
 
278
        }
 
279
 
273
280
        tevent_req_done(search->req);
274
 
        goto done;
 
281
        talloc_free(in);
 
282
        return true;
275
283
 
276
284
nomem:
277
285
        in->recv_errno = ENOMEM;
289
297
        tevent_req_nterror(c->searches.list->req, status);
290
298
done:
291
299
        talloc_free(in);
 
300
        return false;
292
301
}
293
302
 
294
303
/*
320
329
        c->event.ctx = ev;
321
330
 
322
331
        if (!local_addr) {
323
 
                ret = tsocket_address_inet_from_strings(c, "ip",
 
332
                /* we use ipv4 here instead of ip, as otherwise we end
 
333
                   up with a PF_INET6 socket, and sendto() for ipv4
 
334
                   addresses will fail. That breaks cldap name
 
335
                   resolution for winbind to IPv4 hosts. */
 
336
                ret = tsocket_address_inet_from_strings(c, "ipv4",
324
337
                                                        NULL, 0,
325
338
                                                        &any);
326
339
                if (ret != 0) {
946
959
  receive a cldap netlogon reply
947
960
*/
948
961
NTSTATUS cldap_netlogon_recv(struct tevent_req *req,
949
 
                             struct smb_iconv_convenience *iconv_convenience,
950
962
                             TALLOC_CTX *mem_ctx,
951
963
                             struct cldap_netlogon *io)
952
964
{
974
986
        data = state->search.out.response->attributes[0].values;
975
987
 
976
988
        status = pull_netlogon_samlogon_response(data, mem_ctx,
977
 
                                                 iconv_convenience,
978
989
                                                 &io->out.netlogon);
979
990
        if (!NT_STATUS_IS_OK(status)) {
980
991
                goto failed;
994
1005
  sync cldap netlogon search
995
1006
*/
996
1007
NTSTATUS cldap_netlogon(struct cldap_socket *cldap,
997
 
                        struct smb_iconv_convenience *iconv_convenience,
998
1008
                        TALLOC_CTX *mem_ctx,
999
1009
                        struct cldap_netlogon *io)
1000
1010
{
1017
1027
                return NT_STATUS_INTERNAL_ERROR;
1018
1028
        }
1019
1029
 
1020
 
        status = cldap_netlogon_recv(req, iconv_convenience, mem_ctx, io);
 
1030
        status = cldap_netlogon_recv(req, mem_ctx, io);
1021
1031
        talloc_free(req);
1022
1032
 
1023
1033
        return status;
1081
1091
  send a netlogon reply 
1082
1092
*/
1083
1093
NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
1084
 
                              struct smb_iconv_convenience *iconv_convenience,
1085
1094
                              uint32_t message_id,
1086
1095
                              struct tsocket_address *dest,
1087
1096
                              uint32_t version,
1095
1104
        DATA_BLOB blob;
1096
1105
 
1097
1106
        status = push_netlogon_samlogon_response(&blob, tmp_ctx,
1098
 
                                                 iconv_convenience,
1099
1107
                                                 netlogon);
1100
1108
        if (!NT_STATUS_IS_OK(status)) {
1101
1109
                talloc_free(tmp_ctx);