From 34a65a1faa924cd04d68cd23725ded4be7e886ca Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 19 Mar 2019 22:52:18 +0000
Subject: [PATCH] Use DEFFILEMODE (which is user/group/other read/writeable by
 default on *nix) in smb_open*() when creating msgbase files. smblib wasn't
 using the same default file creation mode (permissions) as the rest of the
 Synchronet executables. smblib was creating msgbase files as user
 read/writeable *only* (no group or other permissions) - so the umask value
 for the group/other permissions flags had no effect on msgbase files created
 via smblib. This could lead to permissions issues for other users/groups on
 *nix systems trying to access (read or write) msgbases. No change for
 non-*nix systems.

---
 src/smblib/smbfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/smblib/smbfile.c b/src/smblib/smbfile.c
index 742682e427..3cfec9beee 100644
--- a/src/smblib/smbfile.c
+++ b/src/smblib/smbfile.c
@@ -156,7 +156,7 @@ int SMBCALL smb_open_fp(smb_t* smb, FILE** fp, int share)
 	SAFEPRINTF2(path,"%s.%s",smb->file,ext);
 
 	while(1) {
-		if((file=sopen(path,O_RDWR|O_CREAT|O_BINARY,share,S_IREAD|S_IWRITE))!=-1)
+		if((file=sopen(path,O_RDWR|O_CREAT|O_BINARY,share,DEFFILEMODE))!=-1)
 			break;
 		if(get_errno()!=EACCES && get_errno()!=EAGAIN) {
 			safe_snprintf(smb->last_error,sizeof(smb->last_error)
-- 
GitLab