~ubuntu-branches/ubuntu/maverick/samba/maverick-security

« back to all changes in this revision

Viewing changes to source/libsmb/clifsinfo.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-03-03 22:02:23 UTC
  • mfrom: (0.28.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090303220223-3bdlm2d9fwx1p1ye
Tags: 2:3.3.1-1ubuntu1
* Merge from Debian unstable (LP: #337094), remaining changes:
  + debian/patches/VERSION.patch:
    - setup SAMBA_VERSION_SUFFIX to Ubuntu.
  + 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/mksambapasswd.awk:
    - Do not add user with UID less than 1000 to smbpasswd.
  + debian/control:
    - Make libwbclient0 replace/conflict with hardy's likewise-open.
    - Don't build against ctdb.
  + debian/rules:
    - enable "native" PIE hardening.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
* Dropped changes, merged in Debian:
  + debian/libpam-smbpass.pam-config, debian/libpam-smbpass.postinst,
    debian/libpam-smbpass.prerm, debian/libpam-smbpass.files,
    debian/rules:
    - Make libpam-smbpasswd depend on libpam-runtime to allow 
      libpam-smbpasswd for auto-configuration.
  + debian/control:
    - Provide a config block for the new PAM framework to auto-configure
      itself
  + debian/samba.postinst:
    - When populating the new sambashare group, it is not an error
      if the user simply does not exist; test for this case and let
      the install continue instead of aborting.
  + debian/winbind.files:
    - include additional files

Show diffs side-by-side

added added

removed removed

Lines of Context:
303
303
        return ret;
304
304
}
305
305
 
 
306
bool cli_get_fs_full_size_info(struct cli_state *cli,
 
307
                               SMB_BIG_UINT *total_allocation_units,
 
308
                               SMB_BIG_UINT *caller_allocation_units,
 
309
                               SMB_BIG_UINT *actual_allocation_units,
 
310
                               SMB_BIG_UINT *sectors_per_allocation_unit,
 
311
                               SMB_BIG_UINT *bytes_per_sector)
 
312
{
 
313
        bool ret = False;
 
314
        uint16 setup;
 
315
        char param[2];
 
316
        char *rparam=NULL, *rdata=NULL;
 
317
        unsigned int rparam_count=0, rdata_count=0;
 
318
 
 
319
        setup = TRANSACT2_QFSINFO;
 
320
 
 
321
        SSVAL(param,0,SMB_FS_FULL_SIZE_INFORMATION);
 
322
 
 
323
        if (!cli_send_trans(cli, SMBtrans2,
 
324
                    NULL,
 
325
                    0, 0,
 
326
                    &setup, 1, 0,
 
327
                    param, 2, 0,
 
328
                    NULL, 0, 560)) {
 
329
                goto cleanup;
 
330
        }
 
331
 
 
332
        if (!cli_receive_trans(cli, SMBtrans2,
 
333
                              &rparam, &rparam_count,
 
334
                              &rdata, &rdata_count)) {
 
335
                goto cleanup;
 
336
        }
 
337
 
 
338
        if (cli_is_error(cli)) {
 
339
                ret = False;
 
340
                goto cleanup;
 
341
        } else {
 
342
                ret = True;
 
343
        }
 
344
 
 
345
        if (rdata_count != 32) {
 
346
                goto cleanup;
 
347
        }
 
348
 
 
349
        if (total_allocation_units) {
 
350
                *total_allocation_units = BIG_UINT(rdata, 0);
 
351
        }
 
352
        if (caller_allocation_units) {
 
353
                *caller_allocation_units = BIG_UINT(rdata,8);
 
354
        }
 
355
        if (actual_allocation_units) {
 
356
                *actual_allocation_units = BIG_UINT(rdata,16);
 
357
        }
 
358
        if (sectors_per_allocation_unit) {
 
359
                *sectors_per_allocation_unit = IVAL(rdata,24);
 
360
        }
 
361
        if (bytes_per_sector) {
 
362
                *bytes_per_sector = IVAL(rdata,28);
 
363
        }
 
364
 
 
365
cleanup:
 
366
        SAFE_FREE(rparam);
 
367
        SAFE_FREE(rdata);
 
368
 
 
369
        return ret;
 
370
}
 
371
 
 
372
bool cli_get_posix_fs_info(struct cli_state *cli,
 
373
                           uint32 *optimal_transfer_size,
 
374
                           uint32 *block_size,
 
375
                           SMB_BIG_UINT *total_blocks,
 
376
                           SMB_BIG_UINT *blocks_available,
 
377
                           SMB_BIG_UINT *user_blocks_available,
 
378
                           SMB_BIG_UINT *total_file_nodes,
 
379
                           SMB_BIG_UINT *free_file_nodes,
 
380
                           SMB_BIG_UINT *fs_identifier)
 
381
{
 
382
        bool ret = False;
 
383
        uint16 setup;
 
384
        char param[2];
 
385
        char *rparam=NULL, *rdata=NULL;
 
386
        unsigned int rparam_count=0, rdata_count=0;
 
387
 
 
388
        setup = TRANSACT2_QFSINFO;
 
389
 
 
390
        SSVAL(param,0,SMB_QUERY_POSIX_FS_INFO);
 
391
 
 
392
        if (!cli_send_trans(cli, SMBtrans2,
 
393
                    NULL,
 
394
                    0, 0,
 
395
                    &setup, 1, 0,
 
396
                    param, 2, 0,
 
397
                    NULL, 0, 560)) {
 
398
                goto cleanup;
 
399
        }
 
400
 
 
401
        if (!cli_receive_trans(cli, SMBtrans2,
 
402
                              &rparam, &rparam_count,
 
403
                              &rdata, &rdata_count)) {
 
404
                goto cleanup;
 
405
        }
 
406
 
 
407
        if (cli_is_error(cli)) {
 
408
                ret = False;
 
409
                goto cleanup;
 
410
        } else {
 
411
                ret = True;
 
412
        }
 
413
 
 
414
        if (rdata_count != 56) {
 
415
                goto cleanup;
 
416
        }
 
417
 
 
418
        if (optimal_transfer_size) {
 
419
                *optimal_transfer_size = IVAL(rdata, 0);
 
420
        }
 
421
        if (block_size) {
 
422
                *block_size = IVAL(rdata,4);
 
423
        }
 
424
        if (total_blocks) {
 
425
                *total_blocks = BIG_UINT(rdata,8);
 
426
        }
 
427
        if (blocks_available) {
 
428
                *blocks_available = BIG_UINT(rdata,16);
 
429
        }
 
430
        if (user_blocks_available) {
 
431
                *user_blocks_available = BIG_UINT(rdata,24);
 
432
        }
 
433
        if (total_file_nodes) {
 
434
                *total_file_nodes = BIG_UINT(rdata,32);
 
435
        }
 
436
        if (free_file_nodes) {
 
437
                *free_file_nodes = BIG_UINT(rdata,40);
 
438
        }
 
439
        if (fs_identifier) {
 
440
                *fs_identifier = BIG_UINT(rdata,48);
 
441
        }
 
442
 
 
443
cleanup:
 
444
        SAFE_FREE(rparam);
 
445
        SAFE_FREE(rdata);
 
446
 
 
447
        return ret;
 
448
}
 
449
 
 
450
 
306
451
/******************************************************************************
307
452
 Send/receive the request encryption blob.
308
453
******************************************************************************/