Skip to content

Commit 5f6d01c

Browse files
committed
mysql image plugin
1 parent 27f96cd commit 5f6d01c

File tree

2 files changed

+244
-0
lines changed

2 files changed

+244
-0
lines changed

src/image.c

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
Homepage: http://netkiller.github.io/
3+
Author: netkiller<netkiller@msn.com>
4+
*/
5+
6+
#include <mysql.h>
7+
#include <string.h>
8+
#include <stdio.h>
9+
#include <stdlib.h>
10+
11+
#include "images.h"
12+
13+
/* ------------------------ image_check ----------------------------- */
14+
15+
my_bool image_check_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
16+
{
17+
18+
if (args->arg_count != 1)
19+
{
20+
strncpy(message,
21+
"two arguments must be supplied: image_check('<data>').",
22+
MYSQL_ERRMSG_SIZE);
23+
return 1;
24+
}
25+
args->arg_type[0]= STRING_RESULT;
26+
27+
return 0;
28+
}
29+
30+
char *image_check(UDF_INIT *initid, UDF_ARGS *args,
31+
__attribute__ ((unused)) char *result,
32+
unsigned long *length,
33+
__attribute__ ((unused)) char *is_null,
34+
__attribute__ ((unused)) char *error)
35+
{
36+
37+
char *data;
38+
data = "image_check";
39+
*length = strlen(data);
40+
return ((char *)data);
41+
42+
}
43+
44+
void image_check_deinit(UDF_INIT *initid)
45+
{
46+
return;
47+
}
48+
49+
/* ------------------------ image_move ----------------------------- */
50+
51+
my_bool image_move_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
52+
{
53+
54+
if (args->arg_count != 1)
55+
{
56+
strncpy(message,
57+
"two arguments must be supplied: image_move('<data>').",
58+
MYSQL_ERRMSG_SIZE);
59+
return 1;
60+
}
61+
62+
get_safenet_env();
63+
args->arg_type[0]= STRING_RESULT;
64+
65+
return 0;
66+
}
67+
68+
char *image_move(UDF_INIT *initid, UDF_ARGS *args,
69+
__attribute__ ((unused)) char *result,
70+
unsigned long *length,
71+
__attribute__ ((unused)) char *is_null,
72+
__attribute__ ((unused)) char *error)
73+
{
74+
75+
char *data;
76+
data = "image_move";
77+
*length = strlen(data);
78+
return ((char *)data);
79+
80+
}
81+
82+
void image_move_deinit(UDF_INIT *initid)
83+
{
84+
return;
85+
}
86+
87+
/* ------------------------ image_remove ----------------------------- */
88+
89+
my_bool image_remove_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
90+
{
91+
92+
get_safenet_env();
93+
return 0;
94+
}
95+
96+
char *image_remove(UDF_INIT *initid, UDF_ARGS *args,
97+
__attribute__ ((unused)) char *result,
98+
unsigned long *length,
99+
__attribute__ ((unused)) char *is_null,
100+
__attribute__ ((unused)) char *error)
101+
{
102+
103+
char *config;
104+
//asprintf(&config, "SAFENET_URL=%s, SAFENET_KEY=%s", safe_url, safe_key);
105+
config = "image_remove";
106+
*length = strlen(config);
107+
return ((char *)config);
108+
}
109+
110+
void image_remove_deinit(UDF_INIT *initid)
111+
{
112+
return;
113+
}

src/image.h

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/* src/image.h. Generated from image.h.in by configure. */
2+
/* src/image.h.in. Generated from configure.ac by autoheader. */
3+
4+
/* Define to 1 if you have the <dlfcn.h> header file. */
5+
#define HAVE_DLFCN_H 1
6+
7+
/* Define to 1 if you have the <inttypes.h> header file. */
8+
#define HAVE_INTTYPES_H 1
9+
10+
/* Define to 1 if you have a functional curl library. */
11+
#define HAVE_LIBCURL 1
12+
13+
/* Define to 1 if you have the <limits.h> header file. */
14+
#define HAVE_LIMITS_H 1
15+
16+
/* Define to 1 if you have the <memory.h> header file. */
17+
#define HAVE_MEMORY_H 1
18+
19+
/* Define to 1 if you have the <stdint.h> header file. */
20+
#define HAVE_STDINT_H 1
21+
22+
/* Define to 1 if you have the <stdlib.h> header file. */
23+
#define HAVE_STDLIB_H 1
24+
25+
/* Define to 1 if you have the <strings.h> header file. */
26+
#define HAVE_STRINGS_H 1
27+
28+
/* Define to 1 if you have the <string.h> header file. */
29+
#define HAVE_STRING_H 1
30+
31+
/* Define to 1 if you have the <syslimits.h> header file. */
32+
/* #undef HAVE_SYSLIMITS_H */
33+
34+
/* Define to 1 if you have the <sys/stat.h> header file. */
35+
#define HAVE_SYS_STAT_H 1
36+
37+
/* Define to 1 if you have the <sys/types.h> header file. */
38+
#define HAVE_SYS_TYPES_H 1
39+
40+
/* Define to 1 if you have the <unistd.h> header file. */
41+
#define HAVE_UNISTD_H 1
42+
43+
/* Defined if libcurl supports AsynchDNS */
44+
#define LIBCURL_FEATURE_ASYNCHDNS 1
45+
46+
/* Defined if libcurl supports IDN */
47+
#define LIBCURL_FEATURE_IDN 1
48+
49+
/* Defined if libcurl supports IPv6 */
50+
#define LIBCURL_FEATURE_IPV6 1
51+
52+
/* Defined if libcurl supports KRB4 */
53+
/* #undef LIBCURL_FEATURE_KRB4 */
54+
55+
/* Defined if libcurl supports libz */
56+
#define LIBCURL_FEATURE_LIBZ 1
57+
58+
/* Defined if libcurl supports NTLM */
59+
#define LIBCURL_FEATURE_NTLM 1
60+
61+
/* Defined if libcurl supports SSL */
62+
#define LIBCURL_FEATURE_SSL 1
63+
64+
/* Defined if libcurl supports SSPI */
65+
/* #undef LIBCURL_FEATURE_SSPI */
66+
67+
/* Defined if libcurl supports DICT */
68+
#define LIBCURL_PROTOCOL_DICT 1
69+
70+
/* Defined if libcurl supports FILE */
71+
#define LIBCURL_PROTOCOL_FILE 1
72+
73+
/* Defined if libcurl supports FTP */
74+
#define LIBCURL_PROTOCOL_FTP 1
75+
76+
/* Defined if libcurl supports FTPS */
77+
#define LIBCURL_PROTOCOL_FTPS 1
78+
79+
/* Defined if libcurl supports HTTP */
80+
#define LIBCURL_PROTOCOL_HTTP 1
81+
82+
/* Defined if libcurl supports HTTPS */
83+
#define LIBCURL_PROTOCOL_HTTPS 1
84+
85+
/* Defined if libcurl supports LDAP */
86+
#define LIBCURL_PROTOCOL_LDAP 1
87+
88+
/* Defined if libcurl supports TELNET */
89+
#define LIBCURL_PROTOCOL_TELNET 1
90+
91+
/* Defined if libcurl supports TFTP */
92+
#define LIBCURL_PROTOCOL_TFTP 1
93+
94+
/* Enables MySQL */
95+
#define MYSQL_ENABLED 1
96+
97+
/* Name of package */
98+
#define PACKAGE "image"
99+
100+
/* Define to the address where bug reports for this package should be sent. */
101+
#define PACKAGE_BUGREPORT ""
102+
103+
/* Define to the full name of this package. */
104+
#define PACKAGE_NAME ""
105+
106+
/* Define to the full name and version of this package. */
107+
#define PACKAGE_STRING ""
108+
109+
/* Define to the one symbol short name of this package. */
110+
#define PACKAGE_TARNAME ""
111+
112+
/* Define to the home page for this package. */
113+
#define PACKAGE_URL ""
114+
115+
/* Define to the version of this package. */
116+
#define PACKAGE_VERSION ""
117+
118+
/* Define to 1 if you have the ANSI C header files. */
119+
#define STDC_HEADERS 1
120+
121+
/* Version number of package */
122+
#define VERSION "1.0"
123+
124+
/* Define to empty if `const' does not conform to ANSI C. */
125+
/* #undef const */
126+
127+
/* Define curl_free() as free() if our version of curl lacks curl_free. */
128+
/* #undef curl_free */
129+
130+
/* Define to `unsigned int' if <sys/types.h> does not define. */
131+
/* #undef size_t */

0 commit comments

Comments
 (0)