From 87fda590ee8fd6e5adf25d5fd3a80ffae1b3f7c2 Mon Sep 17 00:00:00 2001 From: Arnold Daniels Date: Thu, 21 Feb 2013 01:39:07 +0100 Subject: [PATCH] Initial commit --- Makefile | 4 + install.sh | 43 +++++ lib_mysqludf_sys.c | 426 ++++++++++++++++++++++++++++++++++++++++++ lib_mysqludf_sys.html | 278 +++++++++++++++++++++++++++ lib_mysqludf_sys.so | Bin 0 -> 12896 bytes lib_mysqludf_sys.sql | 33 ++++ 6 files changed, 784 insertions(+) create mode 100644 Makefile create mode 100755 install.sh create mode 100644 lib_mysqludf_sys.c create mode 100644 lib_mysqludf_sys.html create mode 100755 lib_mysqludf_sys.so create mode 100644 lib_mysqludf_sys.sql diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dbeb729 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +LIBDIR=/usr/lib + +install: + gcc -Wall -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o $(LIBDIR)/lib_mysqludf_sys.so diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..963811b --- /dev/null +++ b/install.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# lib_mysqludf_sys - a library with miscellaneous (operating) system level functions +# Copyright (C) 2007 Roland Bouman +# Copyright (C) 2008-2009 Roland Bouman and Bernardo Damele A. G. +# web: http://www.mysqludf.org/ +# email: mysqludfs@gmail.com, bernardo.damele@gmail.com +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +echo "Compiling the MySQL UDF" +make + +if test $? -ne 0; then + echo "ERROR: You need libmysqlclient development software installed " + echo "to be able to compile this UDF, on Debian/Ubuntu just run:" + echo "apt-get install libmysqlclient15-dev" + exit 1 +else + echo "MySQL UDF compiled successfully" +fi + +echo -e "\nPlease provide your MySQL root password" + +mysql -u root -p mysql < lib_mysqludf_sys.sql + +if test $? -ne 0; then + echo "ERROR: unable to install the UDF" + exit 1 +else + echo "MySQL UDF installed successfully" +fi diff --git a/lib_mysqludf_sys.c b/lib_mysqludf_sys.c new file mode 100644 index 0000000..f352473 --- /dev/null +++ b/lib_mysqludf_sys.c @@ -0,0 +1,426 @@ +/* + lib_mysqludf_sys - a library with miscellaneous (operating) system level functions + Copyright (C) 2007 Roland Bouman + Copyright (C) 2008-2009 Roland Bouman and Bernardo Damele A. G. + web: http://www.mysqludf.org/ + email: mysqludfs@gmail.com, bernardo.damele@gmail.com + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) +#define DLLEXP __declspec(dllexport) +#else +#define DLLEXP +#endif + +#ifdef STANDARD +#include +#include +#include +#ifdef __WIN__ +typedef unsigned __int64 ulonglong; +typedef __int64 longlong; +#else +typedef unsigned long long ulonglong; +typedef long long longlong; +#endif /*__WIN__*/ +#else +#include +#include +#endif +#include +#include +#include +#include + +#include + +#ifdef HAVE_DLOPEN +#ifdef __cplusplus +extern "C" { +#endif + +#define LIBVERSION "lib_mysqludf_sys version 0.0.3" + +#ifdef __WIN__ +#define SETENV(name,value) SetEnvironmentVariable(name,value); +#else +#define SETENV(name,value) setenv(name,value,1); +#endif + +DLLEXP +my_bool lib_mysqludf_sys_info_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +); + +DLLEXP +void lib_mysqludf_sys_info_deinit( + UDF_INIT *initid +); + +DLLEXP +char* lib_mysqludf_sys_info( + UDF_INIT *initid +, UDF_ARGS *args +, char* result +, unsigned long* length +, char *is_null +, char *error +); + +/** + * sys_get + * + * Gets the value of the specified environment variable. + */ +DLLEXP +my_bool sys_get_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +); + +DLLEXP +void sys_get_deinit( + UDF_INIT *initid +); + +DLLEXP +char* sys_get( + UDF_INIT *initid +, UDF_ARGS *args +, char* result +, unsigned long* length +, char *is_null +, char *error +); + +/** + * sys_set + * + * Sets the value of the environment variables. + * This function accepts a set of name/value pairs + * which are then set as environment variables. + * Use sys_get to retrieve the value of such a variable + */ +DLLEXP +my_bool sys_set_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +); + +DLLEXP +void sys_set_deinit( + UDF_INIT *initid +); + +DLLEXP +long long sys_set( + UDF_INIT *initid +, UDF_ARGS *args +, char *is_null +, char *error +); + +/** + * sys_exec + * + * executes the argument commandstring and returns its exit status. + * Beware that this can be a security hazard. + */ +DLLEXP +my_bool sys_exec_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +); + +DLLEXP +void sys_exec_deinit( + UDF_INIT *initid +); + +DLLEXP +my_ulonglong sys_exec( + UDF_INIT *initid +, UDF_ARGS *args +, char *is_null +, char *error +); + +/** + * sys_eval + * + * executes the argument commandstring and returns its standard output. + * Beware that this can be a security hazard. + */ +DLLEXP +my_bool sys_eval_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +); + +DLLEXP +void sys_eval_deinit( + UDF_INIT *initid +); + +DLLEXP +char* sys_eval( + UDF_INIT *initid +, UDF_ARGS *args +, char* result +, unsigned long* length +, char *is_null +, char *error +); + + +#ifdef __cplusplus +} +#endif + +/** + * lib_mysqludf_sys_info + */ +my_bool lib_mysqludf_sys_info_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +){ + my_bool status; + if(args->arg_count!=0){ + strcpy( + message + , "No arguments allowed (udf: lib_mysqludf_sys_info)" + ); + status = 1; + } else { + status = 0; + } + return status; +} +void lib_mysqludf_sys_info_deinit( + UDF_INIT *initid +){ +} +char* lib_mysqludf_sys_info( + UDF_INIT *initid +, UDF_ARGS *args +, char* result +, unsigned long* length +, char *is_null +, char *error +){ + strcpy(result,LIBVERSION); + *length = strlen(LIBVERSION); + return result; +} + +my_bool sys_get_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +){ + if(args->arg_count==1 + && args->arg_type[0]==STRING_RESULT){ + initid->maybe_null = 1; + return 0; + } else { + strcpy( + message + , "Expected exactly one string type parameter" + ); + return 1; + } +} +void sys_get_deinit( + UDF_INIT *initid +){ +} +char* sys_get( + UDF_INIT *initid +, UDF_ARGS *args +, char* result +, unsigned long* length +, char *is_null +, char *error +){ + char* value = getenv(args->args[0]); + if(value == NULL){ + *is_null = 1; + } else { + *length = strlen(value); + } + return value; +} + +my_bool sys_set_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +){ + if(args->arg_count!=2){ + strcpy( + message + , "Expected exactly two arguments" + ); + return 1; + } + if(args->arg_type[0]!=STRING_RESULT){ + strcpy( + message + , "Expected string type for name parameter" + ); + return 1; + } + args->arg_type[1]=STRING_RESULT; + if((initid->ptr=malloc( + args->lengths[0] + + 1 + + args->lengths[1] + + 1 + ))==NULL){ + strcpy( + message + , "Could not allocate memory" + ); + return 1; + } + return 0; +} +void sys_set_deinit( + UDF_INIT *initid +){ + if (initid->ptr!=NULL){ + free(initid->ptr); + } +} +long long sys_set( + UDF_INIT *initid +, UDF_ARGS *args +, char *is_null +, char *error +){ + char *name = initid->ptr; + char *value = name + args->lengths[0] + 1; + memcpy( + name + , args->args[0] + , args->lengths[0] + ); + *(name + args->lengths[0]) = '\0'; + memcpy( + value + , args->args[1] + , args->lengths[1] + ); + *(value + args->lengths[1]) = '\0'; + return SETENV(name,value); +} + +my_bool sys_exec_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +){ + unsigned int i=0; + if(args->arg_count == 1 + && args->arg_type[i]==STRING_RESULT){ + return 0; + } else { + strcpy( + message + , "Expected exactly one string type parameter" + ); + return 1; + } +} +void sys_exec_deinit( + UDF_INIT *initid +){ +} +my_ulonglong sys_exec( + UDF_INIT *initid +, UDF_ARGS *args +, char *is_null +, char *error +){ + return system(args->args[0]); +} + +my_bool sys_eval_init( + UDF_INIT *initid +, UDF_ARGS *args +, char *message +){ + unsigned int i=0; + if(args->arg_count == 1 + && args->arg_type[i]==STRING_RESULT){ + return 0; + } else { + strcpy( + message + , "Expected exactly one string type parameter" + ); + return 1; + } +} +void sys_eval_deinit( + UDF_INIT *initid +){ +} +char* sys_eval( + UDF_INIT *initid +, UDF_ARGS *args +, char* result +, unsigned long* length +, char *is_null +, char *error +){ + FILE *pipe; + char line[1024]; + unsigned long outlen, linelen; + + result = malloc(1); + outlen = 0; + + pipe = popen(args->args[0], "r"); + + while (fgets(line, sizeof(line), pipe) != NULL) { + linelen = strlen(line); + result = realloc(result, outlen + linelen); + strncpy(result + outlen, line, linelen); + outlen = outlen + linelen; + } + + pclose(pipe); + + if (!(*result) || result == NULL) { + *is_null = 1; + } else { + result[outlen] = 0x00; + *length = strlen(result); + } + + return result; +} + + +#endif /* HAVE_DLOPEN */ diff --git a/lib_mysqludf_sys.html b/lib_mysqludf_sys.html new file mode 100644 index 0000000..d762f5f --- /dev/null +++ b/lib_mysqludf_sys.html @@ -0,0 +1,278 @@ + + + + + + +lib_mysqludf_sys - A library of MySQL UDFs for working with the environment in which MySQL runs + + +
+ Top + | Up +
+

lib_mysqludf_sys

+ +

+ This library lib_mysqludf_sys contains a number of functions that allows one to interact with the operating system. +

+
    +
  1. sys_eval - executes an arbitrary command, and returns it's output.
  2. +
  3. sys_exec - executes an arbitrary command, and returns it's exit code.
  4. +
  5. sys_get - gets the value of an environment variable.
  6. +
  7. sys_set - create an environment variable, or update the value of an existing environment variable.
  8. +
+

+ Use lib_mysqludf_sys_info() to obtain information about the currently installed version of lib_mysqludf_sys. +

+ + +

sys_eval

+

+ sys_eval takes one command string argument and executes it, returning its output. +

+

Syntax

+
sys_eval(arg1)
+

Parameters and Return Values

+
+
arg1
+
+ A command string valid for the current operating system or execution environment. +
+
returns
+
+ Whatever output the command pushed to the standard output stream. +
+
+

Installation

+

+ Place the shared library binary in an appropriate location. + Log in to mysql as root or as another user with sufficient privileges, and select any database. + Then, create the function using the following DDL statement: +

+
+CREATE FUNCTION sys_eval RETURNS STRING SONAME 'lib_mysqludf_sys.so';	
+	
+

+ The function will be globally available in all databases. +

+

+ The deinstall the function, run the following statement: +

+
+DROP FUNCTION sys_eval;
+	
+

Examples

+

+ None yet +

+

A Note of Caution

+

+ Be very careful in deciding whether you need this function. + UDFs are available to all database users - you cannot grant EXECUTE privileges for them. + As the commandstring passed to sys_exec can do pretty much everything, + exposing the function poses a very real security hazard. +

+

+ Even for a benign user, it is possible to accidentally do a lot of damage with it. + The call will be executed with the privileges of the os user that runs MySQL, + so it is entirely feasible to delete MySQL's data directory, or worse. +

+

+ The function is intended for specialized MySQL applications where one needs extended + control over the operating system. + Currently, we do not have UDF's for ftp, email and http, + and this function can be used to implement such functionality in case it is really necessary + (datawarehouse staging areas could be a case in example). +

+

+ You have been warned! If you don't see the hazard, please don't try to find it; just trust me on this. +

+

+ If you do decide to use this library in a production environment, make sure that only specific commands can be run and file access is limited by using AppArmor. +

+ +

sys_exec

+

+ sys_exec takes one command string argument and executes it. +

+

Syntax

+
sys_exec(arg1)
+

Parameters and Return Values

+
+
arg1
+
+ A command string valid for the current operating system or execution environment. +
+
returns
+
+ An (integer) exit code returned by the executed process. +
+
+

Installation

+

+ Place the shared library binary in an appropriate location. + Log in to mysql as root or as another user with sufficient privileges, and select any database. + Then, create the function using the following DDL statement: +

+
+CREATE FUNCTION sys_exec RETURNS INT SONAME 'lib_mysqludf_sys.so';	
+	
+

+ The function will be globally available in all databases. +

+

+ The deinstall the function, run the following statement: +

+
+DROP FUNCTION sys_exec;
+	
+

Examples

+

+ None yet +

+

A Note of Caution

+

+ Be very careful in deciding whether you need this function. + UDFs are available to all database users - you cannot grant EXECUTE privileges for them. + As the commandstring passed to sys_exec can do pretty much everything, + exposing the function poses a very real security hazard. +

+

+ Even for a benign user, it is possible to accidentally do a lot of damage with it. + The call will be executed with the privileges of the os user that runs MySQL, + so it is entirely feasible to delete MySQL's data directory, or worse. +

+

+ The function is intended for specialized MySQL applications where one needs extended + control over the operating system. + Currently, we do not have UDF's for ftp, email and http, + and this function can be used to implement such functionality in case it is really necessary + (datawarehouse staging areas could be a case in example). +

+

+ You have been warned! If you don't see the hazard, please don't try to find it; just trust me on this. +

+

+ If you do decide to use this library in a production environment, make sure that only specific commands can be run and file access is limited by using AppArmor. +

+

sys_get

+

+ sys_get takes the name of an environment variable and returns the value of the variable. +

+

Syntax

+
sys_get([arg1)
+

Parameters and Return Values

+
+
arg1
+
+ A string that denotes the name of an environment value. +
+
returns
+
+ If the variable exists, a string containing the value of the environment variable. + If the variable does not exist, the function return NULL. +
+
+

Installation

+

+ Place the shared library binary in an appropriate location. + Log in to mysql as root or as another user with sufficient privileges, and select any database. + Then, create the function using the following DDL statement: +

+
+CREATE FUNCTION sys_get RETURNS STRING SONAME 'lib_mysqludf_sys.so';	
+	
+

+ The function will be globally available in all databases. +

+

+ The deinstall the function, run the following statement: +

+
+DROP FUNCTION sys_get;
+	
+

Examples

+

+ None yet +

+

A Note of Caution

+

+ Be very careful in deciding whether you need this function. + UDFs are available to all database users - you cannot grant EXECUTE privileges for them. + The variables known in the environment where mysql runs are freely accessible using this function. + Any user can get access to potentially secret information, such as + the user that is running mysqld, the path of the user's home directory etc. +

+

+ The function is intended for specialized MySQL applications where one needs extended + control over the operating system. +

+

+ You have been warned! If you don't see the hazard, please don't try to find it; just trust me on this. +

+

sys_set

+

+ sys_get takes the name of an environment variable and returns the value of the variable. +

+

Syntax

+
sys_set([arg1, arg2)
+

Parameters and Return Values

+
+
arg1
+
+ A string that denotes the name of an environment value. +
+
arg2
+
+ An expression that contains the value that is to be assigned to the environment variable. +
+
returns
+
+ 0 if the assignment or creation succeed. + non-zero otherwise. +
+
+

Installation

+

+ Place the shared library binary in an appropriate location. + Log in to mysql as root or as another user with sufficient privileges, and select any database. + Then, create the function using the following DDL statement: +

+
+CREATE FUNCTION sys_set RETURNS STRING SONAME 'lib_mysqludf_sys.so';	
+	
+

+ The function will be globally available in all databases. +

+

+ The deinstall the function, run the following statement: +

+
+DROP FUNCTION sys_set;
+	
+

Examples

+

+ None yet +

+

A Note of Caution

+

+ Be very careful in deciding whether you need this function. + UDFs are available to all database users - you cannot grant EXECUTE privileges for them. + This function will overwrite existing environment variables. +

+

+ The function is intended for specialized MySQL applications where one needs extended + control over the operating system. +

+

+ You have been warned! If you don't see the hazard, please don't try to find it; just trust me on this. +

+ +&FDr1>2#N@=@C|^s(7}*(}}crn_%x z;#39KjNNWiQLN5r)lwAex3(RuwrWaRu%p$e=&0j3%(QhfX^HTD>1T^P$VngFK#&Kmh)wqe4*D)}?TD)67h zV&NK@hn2uJ`G~)G=V2A~fPNHr;W){zY{toZv7F~P!s$q5 zQfQ3##8{1`Q}17Vk=Ghsv2;2cueSM$9XZ$4 zZ341V8;;x_H$Lu3Qidzi)biXesqF5Jr44CPrZi~Lo$W@Ca<1PCFPC8$I?&;~=#Hne zc|?+dj^Ef>SeL1H{uJIKeF?A7vik1t5l>|<>N(4 zD4omC=KgTJNb^?liMpLP?;7Ozh9hX$Kll|q12EL`K^yWI-u&{xQB|ASUt}BnSAJf6 zBD8bYV0lsF-~s3sN0ybNv&sUUY&dacV|XPj0f$Z^bmeFrd(1H$k5;VHA^eItN28Ue z=vBHdjx3-SVlTDAm{3Ej9IZbgANXjKIuMuMilbIR)>=b!U6@slhK~!2_D?US!MFMb zmrXRtZk*QvT5JuMWpvrsQgp2NzA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0 HcmV?d00001 diff --git a/lib_mysqludf_sys.sql b/lib_mysqludf_sys.sql new file mode 100644 index 0000000..6fb7933 --- /dev/null +++ b/lib_mysqludf_sys.sql @@ -0,0 +1,33 @@ +/* + lib_mysqludf_sys - a library with miscellaneous (operating) system level functions + Copyright (C) 2007 Roland Bouman + Copyright (C) 2008-2009 Roland Bouman and Bernardo Damele A. G. + web: http://www.mysqludf.org/ + email: roland.bouman@gmail.com, bernardo.damele@gmail.com + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +DROP FUNCTION IF EXISTS lib_mysqludf_sys_info; +DROP FUNCTION IF EXISTS sys_get; +DROP FUNCTION IF EXISTS sys_set; +DROP FUNCTION IF EXISTS sys_exec; +DROP FUNCTION IF EXISTS sys_eval; + +CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so'; +CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so'; +CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so'; +CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so'; +CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so';