Changeset 751 for trunk/server/source3/printing/nt_printing.c
- Timestamp:
- Nov 29, 2012, 1:59:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/printing/nt_printing.c
r745 r751 1494 1494 1495 1495 static 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); 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 } … … 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; … … 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 } 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 } 1611 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 } … … 1871 1864 printer, ""); 1872 1865 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 1871 void 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.