1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

Update to 4.0.24 release:

- Fix potential security vulnerabilities in the creation of temporary
  table file names and the handling of User Defined Functions (UDFs)
- Add the possibility to specify the database directory in rc.conf
- Move database creation from post-install stage into startup script
This commit is contained in:
Alex Dupre 2005-03-14 10:52:45 +00:00
parent 68d5aea6e8
commit 6b308dae47
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=131178
8 changed files with 79 additions and 271 deletions

View File

@ -6,7 +6,7 @@
#
PORTNAME?= mysql
PORTVERSION= 4.0.23a
PORTVERSION= 4.0.24
PORTREVISION?= 0
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_MYSQL}
@ -17,14 +17,15 @@ MAINTAINER= ale@FreeBSD.org
COMMENT?= Multithreaded SQL database (server)
SLAVEDIRS= databases/mysql40-client
PKGINSTALL?= ${WRKDIR}/pkg-install
DB_DIR?= /var/db/mysql
USE_LIBTOOL_VER=15
USE_REINPLACE= yes
USE_RC_SUBR= yes
.if ${PKGNAMESUFFIX} == "-server"
USE_RC_SUBR= mysql-server.sh
.endif
CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
CONFIGURE_ARGS= --localstatedir=${DB_DIR} \
CONFIGURE_ARGS= --localstatedir=/var/db/mysql \
--without-debug \
--without-readline \
--without-bench \
@ -103,13 +104,15 @@ LATEST_LINK= mysql40-server
CONFLICTS= mysql-server-3.* mysql-server-4.[1-9].* mysql-server-5.*
PLIST_SUB= DB_DIR=${DB_DIR} \
MYSQL_VERSION=${PORTVERSION}
PLIST_SUB= VER=${PORTVERSION}
MAN1= isamchk.1 isamlog.1 mysqld.1 \
mysqld_safe.1 perror.1 replace.1
.if !defined(NOPORTDOCS)
DOCS= manual.html manual.txt manual_toc.html
PORTDOCS= ${DOCS} Flags
.endif
INFO= mysql
@ -120,8 +123,6 @@ pre-fetch:
@${ECHO} " WITH_CHARSET=charset Define the primary built-in charset (latin1)."
@${ECHO} " WITH_XCHARSET=list Define other built-in charsets (may be 'all')."
@${ECHO} " WITH_OPENSSL=yes Enable secure connections."
@${ECHO} " DB_DIR=directory Set alternate directory for database files"
@${ECHO} " (default is /var/db/mysql)."
@${ECHO} " WITH_LINUXTHREADS=yes Use the linuxthreads pthread library."
@${ECHO} " WITH_PROC_SCOPE_PTH=yes Use process scope threads"
@${ECHO} " (try it if you use libpthread)."
@ -142,21 +143,10 @@ post-patch:
@${REINPLACE_CMD} -e "s|PTHREAD_SCOPE_SYSTEM|PTHREAD_SCOPE_PROCESS|g" ${WRKSRC}/libmysqld/lib_sql.cc ${WRKSRC}/sql/mysqld.cc
.endif
post-build:
@${SED} "s|%%DB_DIR%%|${DB_DIR}|g" ${PKGDIR}/pkg-install > ${WRKDIR}/pkg-install
post-install:
.if !defined(PACKAGE_BUILDING)
.if exists(${DB_DIR}) && defined(OVERWRITE_DB) && ${OVERWRITE_DB:L} != "no"
@${RM} -r ${DB_DIR}/mysql ${DB_DIR}/test 2>/dev/null || true
@${SETENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.endif
.if !exists(${DB_DIR}) || (defined(OVERWRITE_DB) && ${OVERWRITE_DB:L} != "no")
${PREFIX}/bin/mysql_install_db --ldata=${DB_DIR}
.endif
@${SETENV} DB_DIR=${DB_DIR} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.endif
@${SED} "s|%%RC_SUBR%%|${RC_SUBR}|g;s|%%PREFIX%%|${PREFIX}|g;s|%%DB_DIR%%|${DB_DIR}|g" < ${FILESDIR}/mysql-server.sh > ${PREFIX}/etc/rc.d/mysql-server.sh
@${CHMOD} 750 ${PREFIX}/etc/rc.d/mysql-server.sh
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}/Flags
.for doc in ${DOCS}

View File

@ -1,2 +1,2 @@
MD5 (mysql-4.0.23a.tar.gz) = ea85758104faf3bb2704af08dd6b3b7d
SIZE (mysql-4.0.23a.tar.gz) = 16735725
MD5 (mysql-4.0.24.tar.gz) = 408d3001ed715ddc90009c247e548638
SIZE (mysql-4.0.24.tar.gz) = 16885399

View File

@ -1,51 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mysql
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable mysql:
# mysql_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable MySQL.
# mysqllimits_enable (bool): Set to "NO" by default.
# Set it to yes to run `limits $limits_args`
# just before mysql starts.
# mysqllimits_args (str): Default to "-e -U mysql"
# Arguments of pre-start limits run.
#
. %%RC_SUBR%%
name="mysql"
rcvar=`set_rcvar`
mysql_dbdir="%%DB_DIR%%"
mysql_user="mysql"
pidfile="${mysql_dbdir}/`/bin/hostname`.pid"
command="%%PREFIX%%/bin/mysqld_safe"
command_args="--user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} > /dev/null &"
procname="%%PREFIX%%/libexec/mysqld"
start_precmd="${name}_prestart"
[ -z "$mysql_enable" ] && mysql_enable="NO"
[ -z "$mysqllimits_enable" ] && mysqllimits_enable="NO"
[ -z "$mysqllimits_args" ] && mysqllimits_args="-e -U ${mysql_user}"
mysql_prestart()
{
if checkyesno mysqllimits_enable; then
eval `/usr/bin/limits ${mysqllimits_args}` 2>/dev/null
else
return 0
fi
}
required_dirs="${mysql_dbdir}"
required_files="${mysql_dbdir}/mysql/host.frm ${mysql_dbdir}/mysql/user.frm ${mysql_dbdir}/mysql/db.frm"
load_rc_config $name
run_rc_command "$1"

View File

@ -0,0 +1,61 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mysql
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable mysql:
# mysql_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable MySQL.
# mysql_limits (bool): Set to "NO" by default.
# Set it to yes to run `limits -e -U mysql`
# just before mysql starts.
# mysql_dbdir (str): Default to "/var/db/mysql"
# Base database directory.
#
. %%RC_SUBR%%
name="mysql"
rcvar=`set_rcvar`
load_rc_config $name
: ${mysql_enable="NO"}
: ${mysql_limits="NO"}
: ${mysql_dbdir="/var/db/mysql"}
mysql_user="mysql"
mysql_limits_args="-e -U ${mysql_user}"
pidfile="${mysql_dbdir}/`/bin/hostname`.pid"
command="%%PREFIX%%/bin/mysqld_safe"
command_args="--user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} > /dev/null &"
procname="%%PREFIX%%/libexec/mysqld"
start_precmd="${name}_prestart"
mysql_install_db="%%PREFIX%%/bin/mysql_install_db"
mysql_install_db_args="--ldata=${mysql_dbdir}"
mysql_create_auth_tables()
{
eval $mysql_install_db $mysql_install_db_args >/dev/null 2>&1
[ $? -eq 0 ] && chown -R ${mysql_user}:${mysql_user} ${mysql_dbdir}
}
mysql_prestart()
{
if [ ! -d "${mysql_dbdir}/mysql/." ]; then
mysql_create_auth_tables || return 1
fi
if checkyesno mysql_limits; then
eval `/usr/bin/limits ${mysql_limits_args}` 2>/dev/null
else
return 0
fi
}
run_rc_command "$1"

View File

@ -1,90 +0,0 @@
--- scripts/mysqlaccess.sh.orig 2005-01-16 14:28:38 -08:00
+++ scripts/mysqlaccess.sh 2005-01-16 14:28:38 -08:00
@@ -2,7 +2,7 @@
# ****************************
package MySQLaccess;
#use strict;
-use POSIX qw(tmpnam);
+use File::Temp qw(tempfile tmpnam);
use Fcntl;
BEGIN {
@@ -32,7 +32,6 @@
$ACCESS_U_BCK = 'user_backup';
$ACCESS_D_BCK = 'db_backup';
$DIFF = '/usr/bin/diff';
- $TMP_PATH = '/tmp'; #path to writable tmp-directory
$MYSQLDUMP = '@bindir@/mysqldump';
#path to mysqldump executable
@@ -432,7 +431,7 @@
# no caching on STDOUT
$|=1;
- $MYSQL_CNF = POSIX::tmpnam();
+ $MYSQL_CNF = tmpnam();
%MYSQL_CNF = (client => { },
mysql => { },
mysqldump => { },
@@ -577,8 +576,6 @@
push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL);
push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF);
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP);
-push(@MySQLaccess::Grant::Error,'not_found_tmp') if !(-d $TMP_PATH);
-push(@MySQLaccess::Grant::Error,'write_err_tmp') if !(-w $TMP_PATH);
if (@MySQLaccess::Grant::Error) {
MySQLaccess::Report::Print_Error_Messages() ;
exit 0;
@@ -1777,17 +1774,15 @@
@before = sort(@before);
@after = sort(@after);
- $before = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.before.$$";
- $after = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.after.$$";
- #$after = "/tmp/t0";
- open(BEFORE,"> $before") ||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $before for writing");
- open(AFTER,"> $after") ||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $after for writing");
- print BEFORE join("\n",@before);
- print AFTER join("\n",@after);
- close(BEFORE);
- close(AFTER);
+ ($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
+ ($ha, $after) = tempfile("$MySQLaccess::script.XXXXXX") or
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
+
+ print $hb join("\n",@before);
+ print $ha join("\n",@after);
+ close $hb;
+ close $ha;
# ----------------------------------
# compute difference
@@ -1800,8 +1795,8 @@
# ----------------------------------
# cleanup temp. files
- unlink(BEFORE);
- unlink(AFTER);
+ unlink($before);
+ unlink($after);
return \@diffs;
}
@@ -2316,14 +2311,6 @@
=> "The diff program <$MySQLaccess::DIFF> could not be found.\n"
."+ Check your path, or\n"
."+ edit the source of this script to point \$DIFF to the diff program.\n"
- ,'not_found_tmp'
- => "The temporary directory <$MySQLaccess::TMP_PATH> could not be found.\n"
- ."+ create this directory (writeable!), or\n"
- ."+ edit the source of this script to point \$TMP_PATH to the right directory.\n"
- ,'write_err_tmp'
- => "The temporary directory <$MySQLaccess::TMP_PATH> is not writable.\n"
- ."+ make this directory writeable!, or\n"
- ."+ edit the source of this script to point \$TMP_PATH to another directory.\n"
,'Unrecognized_option'
=> "Sorry,\n"
."You are using an old version of the mysql-program,\n"

View File

@ -1,6 +1,6 @@
--- sql/mysqld.cc.orig Sat Dec 18 18:25:05 2004
+++ sql/mysqld.cc Sun Jan 9 12:43:21 2005
@@ -99,7 +99,7 @@
--- sql/mysqld.cc.orig Tue Dec 14 13:40:36 2004
+++ sql/mysqld.cc Mon Jan 10 00:28:52 2005
@@ -128,7 +128,7 @@
#endif /* __WIN__ */
#ifdef HAVE_LIBWRAP
@ -9,39 +9,3 @@
#include <syslog.h>
#ifdef NEED_SYS_SYSLOG_H
#include <sys/syslog.h>
@@ -107,15 +107,6 @@
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
-#ifdef __STDC__
-#define my_fromhost(A) fromhost(A)
-#define my_hosts_access(A) hosts_access(A)
-#define my_eval_client(A) eval_client(A)
-#else
-#define my_fromhost(A) fromhost()
-#define my_hosts_access(A) hosts_access()
-#define my_eval_client(A) eval_client()
-#endif
#endif /* HAVE_LIBWRAP */
#ifdef HAVE_SYS_MMAN_H
@@ -3240,8 +3231,8 @@
struct request_info req;
signal(SIGCHLD, SIG_DFL);
request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
- my_fromhost(&req);
- if (!my_hosts_access(&req))
+ fromhost(&req);
+ if (!hosts_access(&req))
{
/*
This may be stupid but refuse() includes an exit(0)
@@ -3249,7 +3240,7 @@
clean_exit() - same stupid thing ...
*/
syslog(deny_severity, "refused connect from %s",
- my_eval_client(&req));
+ eval_client(&req));
/*
C++ sucks (the gibberish in front just translates the supplied

View File

@ -8,7 +8,6 @@ POST-INSTALL)
GROUP=${USER}
UID=88
GID=${UID}
DB_DIR=%%DB_DIR%%
if pw group show "${GROUP}" 2>/dev/null; then
echo "You already have a group \"${GROUP}\", so I will use it."
@ -23,16 +22,9 @@ POST-INSTALL)
if pw user show "${USER}" 2>/dev/null; then
echo "You already have a user \"${USER}\", so I will use it."
if pw usermod ${USER} -d ${DB_DIR}
then
echo "Changed home directory of \"${USER}\" to \"${DB_DIR}\""
else
echo "Changing home directory of \"${USER}\" to \"${DB_DIR}\" failed..."
exit 1
fi
else
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-d ${DB_DIR} -s /sbin/nologin -c "MySQL Daemon"
-d /nonexistent -s /sbin/nologin -c "MySQL Daemon"
then
echo "Added user \"${USER}\"."
else
@ -40,7 +32,5 @@ POST-INSTALL)
exit 1
fi
fi
chown -R ${USER}:${GROUP} ${DB_DIR}
;;
esac

View File

@ -15,7 +15,6 @@ bin/perror
bin/replace
bin/resolve_stack_dump
bin/resolveip
etc/rc.d/mysql-server.sh
lib/mysql/libdbug.a
lib/mysql/libheap.a
lib/mysql/libmerge.a
@ -26,58 +25,6 @@ lib/mysql/libmysys.a
lib/mysql/libnisam.a
lib/mysql/libvio.a
libexec/mysqld
%%PORTDOCS%%%%DOCSDIR%%/Flags/argentina.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/armenia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/australia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/austria.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/belgium.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/brazil.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/bulgaria.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/canada.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/chile.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/china.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/costa-rica.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/croatia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/czech-republic.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/denmark.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/estonia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/finland.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/france.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/germany.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/great-britain.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/greece.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/hungary.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/iceland.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/indonesia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/ireland.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/israel.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/italy.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/japan.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/latvia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/mexico.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/netherlands.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/new-zealand.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/norway.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/philippines.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/poland.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/portugal.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/romania.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/russia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/singapore.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/slovenia.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/south-africa.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/south-korea.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/spain.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/sweden.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/switzerland.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/taiwan.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/turkey.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/ukraine.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/usa.gif
%%PORTDOCS%%%%DOCSDIR%%/Flags/yugoslavia.gif
%%PORTDOCS%%%%DOCSDIR%%/manual.html
%%PORTDOCS%%%%DOCSDIR%%/manual.txt
%%PORTDOCS%%%%DOCSDIR%%/manual_toc.html
%%DATADIR%%/Description.plist
%%DATADIR%%/Info.plist
%%DATADIR%%/MySQL-shared-compat.spec
@ -140,7 +87,7 @@ libexec/mysqld
%%DATADIR%%/my-large.cnf
%%DATADIR%%/my-medium.cnf
%%DATADIR%%/my-small.cnf
%%DATADIR%%/mysql-%%MYSQL_VERSION%%.spec
%%DATADIR%%/mysql-%%VER%%.spec
%%DATADIR%%/mysql-log-rotate
%%DATADIR%%/mysql.server
%%DATADIR%%/norwegian-ny/errmsg.sys
@ -164,8 +111,6 @@ libexec/mysqld
%%DATADIR%%/ukrainian/errmsg.sys
%%DATADIR%%/ukrainian/errmsg.txt
@unexec rmdir %D/lib/mysql 2> /dev/null || true
%%PORTDOCS%%@dirrm %%DOCSDIR%%/Flags
%%PORTDOCS%%@dirrm %%DOCSDIR%%
@dirrm %%DATADIR%%/charsets
@dirrm %%DATADIR%%/czech
@dirrm %%DATADIR%%/danish
@ -190,5 +135,4 @@ libexec/mysqld
@dirrm %%DATADIR%%/swedish
@dirrm %%DATADIR%%/ukrainian
@dirrm %%DATADIR%%
@exec [ -d %%DB_DIR%% ] || %D/bin/mysql_install_db --ldata=%%DB_DIR%%
@unexec /usr/bin/killall mysqld > /dev/null 2>&1 || true