Ignore:
Timestamp:
Nov 29, 2012, 1:59:04 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/printing/nt_printing.c

    r745 r751  
    14941494
    14951495static NTSTATUS driver_unlink_internals(connection_struct *conn,
    1496                                         const char *name)
    1497 {
     1496                                        const char *short_arch,
     1497                                        int vers,
     1498                                        const char *fname)
     1499{
     1500        TALLOC_CTX *tmp_ctx = talloc_new(conn);
    14981501        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);
    15031513        if (!NT_STATUS_IS_OK(status)) {
    1504                 return status;
     1514                goto err_out;
    15051515        }
    15061516
    15071517        status = unlink_internals(conn, NULL, 0, smb_fname, false);
    1508 
    1509         TALLOC_FREE(smb_fname);
     1518err_out:
     1519        talloc_free(tmp_ctx);
    15101520        return status;
    15111521}
     
    15201530                         const struct spoolss_DriverInfo8 *r)
    15211531{
    1522         int i = 0;
    1523         char *s;
    1524         const char *file;
     1532        const char *short_arch;
    15251533        connection_struct *conn;
    15261534        NTSTATUS nt_status;
     
    15731581        }
    15741582
    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 */
    15771591
    15781592        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);
    15841595        }
    15851596
    15861597        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);
    15921600        }
    15931601
    15941602        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);
    16001605        }
    16011606
    16021607        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         }
    1609 
    1610         /* check if we are done removing files */
     1608                DEBUG(10,("deleting helpfile [%s]\n", r->help_file));
     1609                driver_unlink_internals(conn, short_arch, r->version, r->help_file);
     1610        }
    16111611
    16121612        if (r->dependent_files) {
     1613                int i = 0;
    16131614                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]);
    16241617                        i++;
    16251618                }
     
    18711864                                           printer, "");
    18721865        if (!W_ERROR_IS_OK(result)) {
    1873                 DEBUG(0, ("nt_printer_remove: failed to remove rpinter %s",
    1874                           printer));
    1875         }
    1876 }
     1866                DEBUG(0, ("nt_printer_remove: failed to remove printer %s: "
     1867                          "%s\n", printer, win_errstr(result)));
     1868        }
     1869}
     1870
     1871void nt_printer_add(TALLOC_CTX *mem_ctx,
     1872                    const struct auth_serversupplied_info *session_info,
     1873                    struct messaging_context *msg_ctx,
     1874                    const char *printer)
     1875{
     1876        WERROR result;
     1877
     1878        result = winreg_create_printer_internal(mem_ctx, session_info, msg_ctx,
     1879                                                printer);
     1880        if (!W_ERROR_IS_OK(result)) {
     1881                DEBUG(0, ("nt_printer_add: failed to add printer %s: %s\n",
     1882                          printer, win_errstr(result)));
     1883        }
     1884}
Note: See TracChangeset for help on using the changeset viewer.