summaryrefslogtreecommitdiff
path: root/cmd-line-utils
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-11-21 19:13:14 +0200
committerMichael Widenius <monty@askmonty.org>2011-11-21 19:13:14 +0200
commita8d03ab23519d4afc288a6490676ddb8745e3e72 (patch)
treee55f53ff3cc4b044769ca269561a933e3c93f05f /cmd-line-utils
parent04f3ecf632816a940e2838949e0216d638436fd8 (diff)
parent13fefeb04ade34418cd9d99aa93bffb69fdae27e (diff)
downloadmariadb-git-a8d03ab23519d4afc288a6490676ddb8745e3e72.tar.gz
Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
Diffstat (limited to 'cmd-line-utils')
-rw-r--r--cmd-line-utils/libedit/el.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/cmd-line-utils/libedit/el.c b/cmd-line-utils/libedit/el.c
index d99946eb68f..c7f8386773d 100644
--- a/cmd-line-utils/libedit/el.c
+++ b/cmd-line-utils/libedit/el.c
@@ -478,7 +478,13 @@ el_source(EditLine *el, const char *fname)
fp = NULL;
if (fname == NULL) {
-#ifdef HAVE_ISSETUGID
+/* XXXMYSQL: Bug#49967 */
+#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) && \
+ defined(HAVE_GETGID) && defined(HAVE_GETEGID)
+#define HAVE_IDENTITY_FUNCS 1
+#endif
+
+#if (defined(HAVE_ISSETUGID) || defined(HAVE_IDENTITY_FUNCS))
static const char elpath[] = "/.editrc";
/* XXXMYSQL: Portability fix (for which platforms?) */
#ifdef MAXPATHLEN
@@ -486,9 +492,13 @@ el_source(EditLine *el, const char *fname)
#else
char path[4096];
#endif
-
+#ifdef HAVE_ISSETUGID
if (issetugid())
return (-1);
+#elif defined(HAVE_IDENTITY_FUNCS)
+ if (getuid() != geteuid() || getgid() != getegid())
+ return (-1);
+#endif
if ((ptr = getenv("HOME")) == NULL)
return (-1);
if (strlcpy(path, ptr, sizeof(path)) >= sizeof(path))
@@ -498,9 +508,10 @@ el_source(EditLine *el, const char *fname)
fname = path;
#else
/*
- * If issetugid() is missing, always return an error, in order
- * to keep from inadvertently opening up the user to a security
- * hole.
+ * If issetugid() or the above mentioned get[e][u|g]id()
+ * functions are missing, always return an error, in order
+ * to keep from inadvertently opening up the user to a
+ * security hole.
*/
return (-1);
#endif