summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/passdb/secrets.c15
-rw-r--r--source3/passdb/smbpassfile.c34
-rw-r--r--source3/printing/nt_printing.c11
-rw-r--r--source3/smbd/server.c5
5 files changed, 37 insertions, 32 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ae44bdd185..bdb681cea2 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1732,13 +1732,15 @@ BOOL secrets_store(char *key, void *data, size_t size);
BOOL secrets_delete(char *key);
BOOL secrets_store_domain_sid(char *domain, DOM_SID *sid);
BOOL secrets_fetch_domain_sid(char *domain, DOM_SID *sid);
+char *trust_keystr(char *domain);
BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16],
time_t *pass_last_set_time);
BOOL secrets_store_trust_account_password(char *domain, uint8 new_pwd[16]);
+BOOL trust_password_delete(char *domain);
/*The following definitions come from passdb/smbpassfile.c */
-BOOL trust_password_delete(char *domain);
+BOOL migrate_from_old_password_file(char *domain);
/*The following definitions come from printing/load.c */
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 93347e737f..7700c0d28e 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -120,7 +120,7 @@ BOOL secrets_fetch_domain_sid(char *domain, DOM_SID *sid)
/************************************************************************
form a key for fetching a domain trust password
************************************************************************/
-static char *trust_keystr(char *domain)
+char *trust_keystr(char *domain)
{
static fstring keystr;
slprintf(keystr,sizeof(keystr),"%s/%s", SECRETS_MACHINE_ACCT_PASS, domain);
@@ -137,8 +137,8 @@ BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16],
struct machine_acct_pass *pass;
size_t size;
- if (!(pass = secrets_fetch(trust_keystr(domain), &size)) ||
- size != sizeof(*pass)) return False;
+ if (!(pass = secrets_fetch(trust_keystr(domain), &size)) || size != sizeof(*pass))
+ return False;
if (pass_last_set_time) *pass_last_set_time = pass->mod_time;
memcpy(ret_pwd, pass->hash, 16);
@@ -159,3 +159,12 @@ BOOL secrets_store_trust_account_password(char *domain, uint8 new_pwd[16])
return secrets_store(trust_keystr(domain), (void *)&pass, sizeof(pass));
}
+
+/************************************************************************
+ Routine to delete the trust account password file for a domain.
+************************************************************************/
+
+BOOL trust_password_delete(char *domain)
+{
+ return secrets_delete(trust_keystr(domain));
+}
diff --git a/source3/passdb/smbpassfile.c b/source3/passdb/smbpassfile.c
index 72dcbea122..f995d8fd4b 100644
--- a/source3/passdb/smbpassfile.c
+++ b/source3/passdb/smbpassfile.c
@@ -274,46 +274,26 @@ static BOOL get_trust_account_password_from_file( unsigned char *ret_pwd, time_t
}
/************************************************************************
-form a key for fetching a domain trust password
-************************************************************************/
-
-static char *trust_keystr(char *domain)
-{
- static fstring keystr;
- slprintf(keystr,sizeof(keystr),"%s/%s", SECRETS_MACHINE_ACCT_PASS, domain);
- return keystr;
-}
-
-/************************************************************************
Migrate an old DOMAIN.MACINE.mac password file to the tdb secrets db.
************************************************************************/
-static void migrate_from_old_password_file(char *domain)
+BOOL migrate_from_old_password_file(char *domain)
{
struct machine_acct_pass pass;
if (!trust_password_file_lock(domain, global_myname))
- return;
+ return True;
if (!get_trust_account_password_from_file( pass.hash, &pass.mod_time)) {
trust_password_file_unlock();
- return;
+ return False;
}
- trust_password_file_delete(domain, global_myname);
-
- secrets_store(trust_keystr(domain), (void *)&pass, sizeof(pass));
+ if (!secrets_store(trust_keystr(domain), (void *)&pass, sizeof(pass)))
+ return False;
+ trust_password_file_delete(domain, global_myname);
trust_password_file_unlock();
- return;
-}
-/************************************************************************
- Routine to delete the trust account password file for a domain.
-************************************************************************/
-
-BOOL trust_password_delete(char *domain)
-{
- return secrets_delete(trust_keystr(domain));
+ return True;
}
-
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index bbe01b87f6..af2be89e23 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -353,6 +353,7 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,
fstring user_name;
fstring null_pw;
files_struct *fsp = NULL;
+ BOOL bad_path;
SMB_STRUCT_STAT st;
struct passwd *pass;
connection_struct *conn;
@@ -404,6 +405,9 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,
/* Open the driver file (Portable Executable format) and determine the
* deriver the cversion. */
slprintf(driverpath, sizeof(driverpath), "%s/%s", architecture, driverpath_in);
+
+ unix_convert(driverpath,conn,NULL,&bad_path,&st);
+
fsp = open_file_shared(conn, driverpath, &st,
SET_OPEN_MODE(DOS_OPEN_RDONLY),
(FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),
@@ -956,7 +960,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file,
files_struct *fsp = NULL;
SMB_STRUCT_STAT st;
SMB_STRUCT_STAT stat_buf;
-
+ BOOL bad_path;
+
ZERO_STRUCT(st);
ZERO_STRUCT(stat_buf);
new_create_time = (time_t)0;
@@ -965,6 +970,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file,
/* Get file version info (if available) for previous file (if it exists) */
pstrcpy(filepath, old_file);
+ unix_convert(filepath,conn,NULL,&bad_path,&stat_buf);
+
fsp = open_file_shared(conn, filepath, &stat_buf,
SET_OPEN_MODE(DOS_OPEN_RDONLY),
(FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),
@@ -994,6 +1001,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file,
/* Get file version info (if available) for new file */
pstrcpy(filepath, new_file);
+ unix_convert(filepath,conn,NULL,&bad_path,&stat_buf);
+
fsp = open_file_shared(conn, filepath, &stat_buf,
SET_OPEN_MODE(DOS_OPEN_RDONLY),
(FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 97a05686c3..07e554c4fb 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -725,6 +725,11 @@ static void usage(char *pname)
claim_connection(NULL,"",MAXSTATUS,True);
}
+ /* Attempt to migrate from an old 2.0.x machine account file. */
+ if (!migrate_from_old_password_file(global_myworkgroup)) {
+ DEBUG(0,("Failed to migrate from old MAC file.\n"));
+ }
+
if (!open_sockets(is_daemon,port))
exit(1);