~ubuntu-branches/ubuntu/utopic/samba/utopic

« back to all changes in this revision

Viewing changes to source3/smbd/dir.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-21 09:06:34 UTC
  • mfrom: (0.39.23 sid)
  • Revision ID: package-import@ubuntu.com-20120221090634-svd7q7m33pfz0847
Tags: 2:3.6.3-1ubuntu1
* 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/fix-samba-printer-browsing.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
260
260
                goto done;
261
261
        }
262
262
 
 
263
        if (sconn->using_smb2) {
 
264
                goto done;
 
265
        }
 
266
 
263
267
        DLIST_REMOVE(sconn->searches.dirptrs, dptr);
264
268
 
265
269
        /*
279
283
 
280
284
        /* Lanman 2 specific code */
281
285
        SAFE_FREE(dptr->wcard);
282
 
        string_set(&dptr->path,"");
 
286
        SAFE_FREE(dptr->path);
283
287
        SAFE_FREE(dptr);
284
288
}
285
289
 
470
474
 
471
475
        ZERO_STRUCTP(dptr);
472
476
 
 
477
        dptr->path = SMB_STRDUP(path);
 
478
        if (!dptr->path) {
 
479
                SAFE_FREE(dptr);
 
480
                TALLOC_FREE(dir_hnd);
 
481
                return NT_STATUS_NO_MEMORY;
 
482
        }
 
483
        dptr->conn = conn;
 
484
        dptr->dir_hnd = dir_hnd;
 
485
        dptr->spid = spid;
 
486
        dptr->expect_close = expect_close;
 
487
        dptr->wcard = SMB_STRDUP(wcard);
 
488
        if (!dptr->wcard) {
 
489
                SAFE_FREE(dptr->path);
 
490
                SAFE_FREE(dptr);
 
491
                TALLOC_FREE(dir_hnd);
 
492
                return NT_STATUS_NO_MEMORY;
 
493
        }
 
494
        if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) {
 
495
                dptr->has_wild = True;
 
496
        } else {
 
497
                dptr->has_wild = wcard_has_wild;
 
498
        }
 
499
 
 
500
        dptr->attr = attr;
 
501
 
 
502
        if (sconn->using_smb2) {
 
503
                goto done;
 
504
        }
 
505
 
473
506
        if(old_handle) {
474
507
 
475
508
                /*
493
526
                        dptr->dnum = bitmap_find(sconn->searches.dptr_bmap, 0);
494
527
                        if(dptr->dnum == -1 || dptr->dnum > 254) {
495
528
                                DEBUG(0,("dptr_create: returned %d: Error - all old dirptrs in use ?\n", dptr->dnum));
 
529
                                SAFE_FREE(dptr->path);
 
530
                                SAFE_FREE(dptr->wcard);
496
531
                                SAFE_FREE(dptr);
497
532
                                TALLOC_FREE(dir_hnd);
498
533
                                return NT_STATUS_TOO_MANY_OPENED_FILES;
523
558
 
524
559
                        if(dptr->dnum == -1 || dptr->dnum < 255) {
525
560
                                DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use ?\n", dptr->dnum));
 
561
                                SAFE_FREE(dptr->path);
 
562
                                SAFE_FREE(dptr->wcard);
526
563
                                SAFE_FREE(dptr);
527
564
                                TALLOC_FREE(dir_hnd);
528
565
                                return NT_STATUS_TOO_MANY_OPENED_FILES;
534
571
 
535
572
        dptr->dnum += 1; /* Always bias the dnum by one - no zero dnums allowed. */
536
573
 
537
 
        string_set(&dptr->path,path);
538
 
        dptr->conn = conn;
539
 
        dptr->dir_hnd = dir_hnd;
540
 
        dptr->spid = spid;
541
 
        dptr->expect_close = expect_close;
542
 
        dptr->wcard = SMB_STRDUP(wcard);
543
 
        if (!dptr->wcard) {
544
 
                bitmap_clear(sconn->searches.dptr_bmap, dptr->dnum - 1);
545
 
                SAFE_FREE(dptr);
546
 
                TALLOC_FREE(dir_hnd);
547
 
                return NT_STATUS_NO_MEMORY;
548
 
        }
549
 
        if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) {
550
 
                dptr->has_wild = True;
551
 
        } else {
552
 
                dptr->has_wild = wcard_has_wild;
553
 
        }
554
 
 
555
 
        dptr->attr = attr;
556
 
 
557
574
        DLIST_ADD(sconn->searches.dirptrs, dptr);
558
575
 
 
576
done:
559
577
        DEBUG(3,("creating new dirptr %d for path %s, expect_close = %d\n",
560
578
                dptr->dnum,path,expect_close));  
561
579
 
1327
1345
#endif
1328
1346
                SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir);
1329
1347
        }
1330
 
        if (dirp->conn->sconn) {
 
1348
        if (dirp->conn->sconn && !dirp->conn->sconn->using_smb2) {
1331
1349
                dirp->conn->sconn->searches.dirhandles_open--;
1332
1350
        }
1333
1351
        return 0;
1358
1376
                goto fail;
1359
1377
        }
1360
1378
 
1361
 
        if (sconn) {
 
1379
        if (sconn && !sconn->using_smb2) {
1362
1380
                sconn->searches.dirhandles_open++;
1363
1381
        }
1364
1382
        talloc_set_destructor(dirp, smb_Dir_destructor);
1402
1420
                goto fail;
1403
1421
        }
1404
1422
 
1405
 
        if (sconn) {
 
1423
        if (sconn && !sconn->using_smb2) {
1406
1424
                sconn->searches.dirhandles_open++;
1407
1425
        }
1408
1426
        talloc_set_destructor(dirp, smb_Dir_destructor);