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

« back to all changes in this revision

Viewing changes to source3/printing/nt_printing.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:
1493
1493
}
1494
1494
 
1495
1495
static NTSTATUS driver_unlink_internals(connection_struct *conn,
1496
 
                                        const char *name)
 
1496
                                        const char *short_arch,
 
1497
                                        int vers,
 
1498
                                        const char *fname)
1497
1499
{
 
1500
        TALLOC_CTX *tmp_ctx = talloc_new(conn);
1498
1501
        struct smb_filename *smb_fname = NULL;
1499
 
        NTSTATUS status;
1500
 
 
1501
 
        status = create_synthetic_smb_fname(talloc_tos(), name, NULL, NULL,
1502
 
            &smb_fname);
 
1502
        char *print_dlr_path;
 
1503
        NTSTATUS status = NT_STATUS_NO_MEMORY;
 
1504
 
 
1505
        print_dlr_path = talloc_asprintf(tmp_ctx, "%s/%d/%s",
 
1506
                                         short_arch, vers, fname);
 
1507
        if (print_dlr_path == NULL) {
 
1508
                goto err_out;
 
1509
        }
 
1510
 
 
1511
        status = create_synthetic_smb_fname(tmp_ctx, print_dlr_path,
 
1512
                                            NULL, NULL, &smb_fname);
1503
1513
        if (!NT_STATUS_IS_OK(status)) {
1504
 
                return status;
 
1514
                goto err_out;
1505
1515
        }
1506
1516
 
1507
1517
        status = unlink_internals(conn, NULL, 0, smb_fname, false);
1508
 
 
1509
 
        TALLOC_FREE(smb_fname);
 
1518
err_out:
 
1519
        talloc_free(tmp_ctx);
1510
1520
        return status;
1511
1521
}
1512
1522
 
1519
1529
bool delete_driver_files(const struct auth_serversupplied_info *session_info,
1520
1530
                         const struct spoolss_DriverInfo8 *r)
1521
1531
{
1522
 
        int i = 0;
1523
 
        char *s;
1524
 
        const char *file;
 
1532
        const char *short_arch;
1525
1533
        connection_struct *conn;
1526
1534
        NTSTATUS nt_status;
1527
1535
        char *oldcwd;
1572
1580
                goto err_out;
1573
1581
        }
1574
1582
 
1575
 
        /* now delete the files; must strip the '\print$' string from
1576
 
           fron of path                                                */
 
1583
        short_arch = get_short_archi(r->architecture);
 
1584
        if (short_arch == NULL) {
 
1585
                DEBUG(0, ("bad architecture %s\n", r->architecture));
 
1586
                ret = false;
 
1587
                goto err_out;
 
1588
        }
 
1589
 
 
1590
        /* now delete the files */
1577
1591
 
1578
1592
        if (r->driver_path && r->driver_path[0]) {
1579
 
                if ((s = strchr(&r->driver_path[1], '\\')) != NULL) {
1580
 
                        file = s;
1581
 
                        DEBUG(10,("deleting driverfile [%s]\n", s));
1582
 
                        driver_unlink_internals(conn, file);
1583
 
                }
 
1593
                DEBUG(10,("deleting driverfile [%s]\n", r->driver_path));
 
1594
                driver_unlink_internals(conn, short_arch, r->version, r->driver_path);
1584
1595
        }
1585
1596
 
1586
1597
        if (r->config_file && r->config_file[0]) {
1587
 
                if ((s = strchr(&r->config_file[1], '\\')) != NULL) {
1588
 
                        file = s;
1589
 
                        DEBUG(10,("deleting configfile [%s]\n", s));
1590
 
                        driver_unlink_internals(conn, file);
1591
 
                }
 
1598
                DEBUG(10,("deleting configfile [%s]\n", r->config_file));
 
1599
                driver_unlink_internals(conn, short_arch, r->version, r->config_file);
1592
1600
        }
1593
1601
 
1594
1602
        if (r->data_file && r->data_file[0]) {
1595
 
                if ((s = strchr(&r->data_file[1], '\\')) != NULL) {
1596
 
                        file = s;
1597
 
                        DEBUG(10,("deleting datafile [%s]\n", s));
1598
 
                        driver_unlink_internals(conn, file);
1599
 
                }
 
1603
                DEBUG(10,("deleting datafile [%s]\n", r->data_file));
 
1604
                driver_unlink_internals(conn, short_arch, r->version, r->data_file);
1600
1605
        }
1601
1606
 
1602
1607
        if (r->help_file && r->help_file[0]) {
1603
 
                if ((s = strchr(&r->help_file[1], '\\')) != NULL) {
1604
 
                        file = s;
1605
 
                        DEBUG(10,("deleting helpfile [%s]\n", s));
1606
 
                        driver_unlink_internals(conn, file);
1607
 
                }
 
1608
                DEBUG(10,("deleting helpfile [%s]\n", r->help_file));
 
1609
                driver_unlink_internals(conn, short_arch, r->version, r->help_file);
1608
1610
        }
1609
1611
 
1610
 
        /* check if we are done removing files */
1611
 
 
1612
1612
        if (r->dependent_files) {
 
1613
                int i = 0;
1613
1614
                while (r->dependent_files[i] && r->dependent_files[i][0]) {
1614
 
                        char *p;
1615
 
 
1616
 
                        /* bypass the "\print$" portion of the path */
1617
 
 
1618
 
                        if ((p = strchr(r->dependent_files[i]+1, '\\')) != NULL) {
1619
 
                                file = p;
1620
 
                                DEBUG(10,("deleting dependent file [%s]\n", file));
1621
 
                                driver_unlink_internals(conn, file);
1622
 
                        }
1623
 
 
 
1615
                        DEBUG(10,("deleting dependent file [%s]\n", r->dependent_files[i]));
 
1616
                        driver_unlink_internals(conn, short_arch, r->version, r->dependent_files[i]);
1624
1617
                        i++;
1625
1618
                }
1626
1619
        }