diff options
author | unknown <jani@ua126d19.elisa.omakaista.fi> | 2003-06-05 16:57:36 +0300 |
---|---|---|
committer | unknown <jani@ua126d19.elisa.omakaista.fi> | 2003-06-05 16:57:36 +0300 |
commit | a86c80e46a8a8eec5058eaaf8190ea69ecca0cf5 (patch) | |
tree | d12644499b2610eee89da5c126bb797b427262fc | |
parent | d3d86c127a0740a7f44255d138c75e42195a47c0 (diff) | |
parent | 35cd3cbac79731d04a10e08bf8b7ab27cfc4c046 (diff) | |
download | mariadb-git-a86c80e46a8a8eec5058eaaf8190ea69ecca0cf5.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into ua126d19.elisa.omakaista.fi:/home/my/bk/mysql-4.0
-rw-r--r-- | sql/mysqld.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8ed183e2f1f..315931094c2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1013,14 +1013,21 @@ static void set_ports() static void set_user(const char *user) { #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) - struct passwd *ent; + struct passwd *ent; + uid_t user_id= geteuid(); // don't bother if we aren't superuser - if (geteuid()) + if (user_id) { if (user) - fprintf(stderr, - "Warning: One can only use the --user switch if running as root\n"); + { + /* Don't give a warning, if real user is same as given with --user */ + struct passwd *user_info= getpwnam(user); + + if (!user_info || user_id != user_info->pw_uid) + fprintf(stderr, + "Warning: One can only use the --user switch if running as root\n"); + } return; } else if (!user) |