1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3-printing: fix migrate printer code (bug 8618)

Removed path from driver files.
We only need the basenames.
(cherry picked from commit d61993043f)
This commit is contained in:
Björn Baumbach 2011-11-18 18:54:56 +01:00 committed by Karolin Seeger
parent cc2ba64e21
commit 9f07ef2249

View File

@ -3,6 +3,7 @@
* RPC Pipe client / server routines * RPC Pipe client / server routines
* *
* Copyright (c) Andreas Schneider 2010. * Copyright (c) Andreas Schneider 2010.
* Copyright (C) Bjoern Baumbach <bb@sernet.de> 2011
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -27,6 +28,20 @@
#include "librpc/gen_ndr/ndr_security.h" #include "librpc/gen_ndr/ndr_security.h"
#include "rpc_client/cli_winreg_spoolss.h" #include "rpc_client/cli_winreg_spoolss.h"
static const char *driver_file_basename(const char *file)
{
const char *basefile;
basefile = strrchr(file, '\\');
if (basefile == NULL) {
basefile = file;
} else {
basefile++;
}
return basefile;
}
NTSTATUS printing_tdb_migrate_form(TALLOC_CTX *mem_ctx, NTSTATUS printing_tdb_migrate_form(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *winreg_pipe, struct rpc_pipe_client *winreg_pipe,
const char *key_name, const char *key_name,
@ -100,6 +115,7 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
WERROR result; WERROR result;
const char *driver_name; const char *driver_name;
uint32_t driver_version; uint32_t driver_version;
int i;
blob = data_blob_const(data, length); blob = data_blob_const(data, length);
@ -118,8 +134,19 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(d3); ZERO_STRUCT(d3);
ZERO_STRUCT(a); ZERO_STRUCT(a);
/* remove paths from file names */
if (r.dependent_files != NULL) {
for (i = 0 ; r.dependent_files[i] != NULL; i++) {
r.dependent_files[i] = driver_file_basename(r.dependent_files[i]);
}
}
a.string = r.dependent_files; a.string = r.dependent_files;
r.driverpath = driver_file_basename(r.driverpath);
r.configfile = driver_file_basename(r.configfile);
r.datafile = driver_file_basename(r.datafile);
r.helpfile = driver_file_basename(r.helpfile);
d3.architecture = r.environment; d3.architecture = r.environment;
d3.config_file = r.configfile; d3.config_file = r.configfile;
d3.data_file = r.datafile; d3.data_file = r.datafile;