driver_unix_convert(driverpath,conn,NULL,&bad_path,&st);
+ if ( !vfs_file_exist( conn, driverpath, &st ) ) {
+ *perr = WERR_BADFILE;
+ goto error_exit;
+ }
+
fsp = open_file_shared(conn, driverpath, &st,
- SET_DENY_MODE(DENY_NONE)|SET_OPEN_MODE(DOS_OPEN_RDONLY),
- (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),
- FILE_ATTRIBUTE_NORMAL, INTERNAL_OPEN_ONLY, &access_mode, &action);
+ SET_DENY_MODE(DENY_NONE)|SET_OPEN_MODE(DOS_OPEN_RDONLY),
+ (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),
+ FILE_ATTRIBUTE_NORMAL, INTERNAL_OPEN_ONLY, &access_mode, &action);
+
if (!fsp) {
DEBUG(3,("get_correct_cversion: Can't open file [%s], errno = %d\n",
driverpath, errno));
driverpath, major, minor));
}
- DEBUG(10,("get_correct_cversion: Driver file [%s] cversion = %d\n",
- driverpath, cversion));
+ DEBUG(10,("get_correct_cversion: Driver file [%s] cversion = %d\n",
+ driverpath, cversion));
close_file(fsp, True);
close_cnum(conn, user->vuid);
* NT 4: cversion=2
* NT2K: cversion=3
*/
- if ((driver->cversion = get_correct_cversion( architecture,
- driver->driverpath, user, &err)) == -1)
- return err;
+ if ((driver->cversion = get_correct_cversion( architecture, driver->driverpath, user, &err)) == -1)
+ return err;
return WERR_OK;
}
* NT 4: cversion=2
* NT2K: cversion=3
*/
+
if ((driver->version = get_correct_cversion(architecture, driver->driverpath, user, &err)) == -1)
- return err;
+ return err;
return WERR_OK;
}
SMB_STRUCT_STAT st;
int ver = 0;
int i;
+ int err;
memset(inbuf, '\0', sizeof(inbuf));
memset(outbuf, '\0', sizeof(outbuf));
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
NTSTATUS status;
driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- status = rename_internals(conn, new_name, old_name, 0, True);
- if (!NT_STATUS_IS_OK(status)) {
+ if ( !copy_file(new_name, old_name, conn, FILE_EXISTS_TRUNCATE|FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
new_name, old_name));
*perr = ntstatus_to_werror(status);
- unlink_internals(conn, 0, new_name);
ver = -1;
}
- } else {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- unlink_internals(conn, 0, new_name);
- }
+ }
}
if (driver->datafile && strlen(driver->datafile)) {
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
NTSTATUS status;
driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- status = rename_internals(conn, new_name, old_name, 0, True);
- if (!NT_STATUS_IS_OK(status)) {
+ if ( !copy_file(new_name, old_name, conn, FILE_EXISTS_TRUNCATE|FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
new_name, old_name));
*perr = ntstatus_to_werror(status);
- unlink_internals(conn, 0, new_name);
ver = -1;
}
- } else {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- unlink_internals(conn, 0, new_name);
}
}
}
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
NTSTATUS status;
driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- status = rename_internals(conn, new_name, old_name, 0, True);
- if (!NT_STATUS_IS_OK(status)) {
+ if ( !copy_file(new_name, old_name, conn, FILE_EXISTS_TRUNCATE|FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
new_name, old_name));
*perr = ntstatus_to_werror(status);
- unlink_internals(conn, 0, new_name);
ver = -1;
}
- } else {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- unlink_internals(conn, 0, new_name);
}
}
}
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
NTSTATUS status;
driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- status = rename_internals(conn, new_name, old_name, 0, True);
- if (!NT_STATUS_IS_OK(status)) {
+ if ( !copy_file(new_name, old_name, conn, FILE_EXISTS_TRUNCATE|FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
new_name, old_name));
*perr = ntstatus_to_werror(status);
- unlink_internals(conn, 0, new_name);
ver = -1;
}
- } else {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- unlink_internals(conn, 0, new_name);
}
}
}
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
NTSTATUS status;
driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- status = rename_internals(conn, new_name, old_name, 0, True);
- if (!NT_STATUS_IS_OK(status)) {
+ if ( !copy_file(new_name, old_name, conn, FILE_EXISTS_TRUNCATE|FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
new_name, old_name));
*perr = ntstatus_to_werror(status);
- unlink_internals(conn, 0, new_name);
ver = -1;
}
- } else {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
- unlink_internals(conn, 0, new_name);
}
}
NextDriver: ;