Hi!
>>>>> "Jeremy" == Jeremy Zawodny <jzawodn@stripped> writes:
Jeremy> Yahoo! GeoCities is planning to offer MySQL to their hosting customers
Jeremy> (they already get PHP). To run MySQL in the environment they are
Jeremy> constructing, it's necessary for mysqld to be able to run as a uid
Jeremy> that doesn't map to a username.
Jeremy> The following patch appears to solve that problem. Could the patch
Jeremy> (or something like it) be applied to the 4.0 and maybe 3.23 tree?
<cut>
I have now added the following patch to 4.0.2:
===== mysqld.cc 1.279 vs edited =====
*** /tmp/mysqld.cc-1.279-27258 Mon Feb 11 13:34:17 2002
--- edited/mysqld.cc Mon Feb 11 22:12:57 2002
***************
*** 856,875 ****
if (!strcmp(user,"root"))
return; // Avoid problem with dynamic libraries
if (!(ent = getpwnam(user)))
{
! fprintf(stderr,"Fatal error: Can't change to run as user '%s' ; Please check that
the user exists!\n",user);
! unireg_abort(1);
}
#ifdef HAVE_INITGROUPS
! initgroups((char*) user,ent->pw_gid);
#endif
! if (setgid(ent->pw_gid) == -1)
! {
! sql_perror("setgid");
! unireg_abort(1);
}
! if (setuid(ent->pw_uid) == -1)
{
sql_perror("setuid");
unireg_abort(1);
--- 856,888 ----
if (!strcmp(user,"root"))
return; // Avoid problem with dynamic libraries
+ uid_t uid;
if (!(ent = getpwnam(user)))
{
! // allow a numeric uid to be used
! const char *pos;
! for (pos=user; isdigit(*pos); pos++) ;
! if (*pos) // Not numeric id
! {
! fprintf(stderr,"Fatal error: Can't change to run as user '%s' ; Please check that
the user exists!\n",user);
! unireg_abort(1);
! }
! uid=atoi(user); // Use numberic uid
}
+ else
+ {
#ifdef HAVE_INITGROUPS
! initgroups((char*) user,ent->pw_gid);
#endif
! if (setgid(ent->pw_gid) == -1)
! {
! sql_perror("setgid");
! unireg_abort(1);
! }
! uid=ent->pw_uid;
}
!
! if (setuid(uid) == -1)
{
sql_perror("setuid");
unireg_abort(1);
Regards,
Monty