summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-08-17 08:12:33 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-08-17 08:12:33 +0000
commit327fda27eddfb1be7f0e344e86cca438c103c6ea (patch)
tree2198cf64edb36c9b91e6635ad652c0aad861a2a4 /source3/smbd
parent67967749a2ed584de3b0d670094724021eafc50b (diff)
downloadsamba-327fda27eddfb1be7f0e344e86cca438c103c6ea.tar.gz
samba-327fda27eddfb1be7f0e344e86cca438c103c6ea.tar.bz2
samba-327fda27eddfb1be7f0e344e86cca438c103c6ea.zip
Move admin user check into a helper function.
Formatting fixes. (This used to be commit 6fd8eb08c12d0446ab639becf8825d26bce8eb8a)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/service.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 5bb535f884..3e29c8cf58 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -286,6 +286,37 @@ static void set_read_only(connection_struct *conn)
/****************************************************************************
+ admin user check
+****************************************************************************/
+static void set_admin_user(connection_struct *conn)
+{
+ /* admin user check */
+
+ /* JRA - original code denied admin user if the share was
+ marked read_only. Changed as I don't think this is needed,
+ but old code left in case there is a problem here.
+ */
+ if (user_in_list(conn->user,lp_admin_users(conn->service))
+#if 0
+ && !conn->read_only
+#endif
+ ) {
+ conn->admin_user = True;
+ DEBUG(0,("%s logged in as admin user (root privileges)\n",conn->user));
+ } else {
+ conn->admin_user = False;
+ }
+
+#if 0 /* This done later, for now */
+ /* admin users always run as uid=0 */
+ if (conn->admin_user) {
+ conn->uid = 0;
+ }
+#endif
+}
+
+
+/****************************************************************************
make a connection to a service
****************************************************************************/
connection_struct *make_connection(char *service,char *user,char *password, int pwlen, char *dev,uint16 vuid, int *ecode)
@@ -381,7 +412,8 @@ connection_struct *make_connection(char *service,char *user,char *password, int
conn->vuid = vuid;
conn->uid = pass->pw_uid;
conn->gid = pass->pw_gid;
- safe_strcpy(conn->client_address, client_addr(), sizeof(conn->client_address)-1);
+ safe_strcpy(conn->client_address, client_addr(),
+ sizeof(conn->client_address)-1);
conn->num_files_open = 0;
conn->lastused = time(NULL);
conn->service = snum;
@@ -398,23 +430,8 @@ connection_struct *make_connection(char *service,char *user,char *password, int
set_read_only(conn);
- /* admin user check */
-
- /* JRA - original code denied admin user if the share was
- marked read_only. Changed as I don't think this is needed,
- but old code left in case there is a problem here.
- */
- if (user_in_list(user, lp_admin_users(snum))
-#if 0
- && !conn->read_only
-#endif
- ) {
- conn->admin_user = True;
- DEBUG(0,("%s logged in as admin user (root privileges)\n",user));
- } else {
- conn->admin_user = False;
- }
-
+ set_admin_user(conn);
+
/*
* If force user is true, then store the
* given userid and also the primary groupid