Changeset: 88baa725fd26 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=88baa725fd26
Modified Files:
        sql/src/backends/monet5/merovingian/control.c
        sql/src/backends/monet5/merovingian/control.h
        sql/src/backends/monet5/merovingian/database.c
        sql/src/backends/monet5/merovingian/database.h
        sql/src/backends/monet5/merovingian/glob.c
        sql/src/backends/monet5/merovingian/glob.h
        sql/src/backends/monet5/merovingian/merovingian.1.in
        sql/src/backends/monet5/merovingian/merovingian.c
        sql/src/backends/monet5/merovingian/merovingian_client.c
        sql/src/backends/monet5/merovingian/merovingian_connections.c
        sql/src/backends/monet5/merovingian/merovingian_controlrunner.c
        sql/src/backends/monet5/merovingian/merovingian_discoveryrunner.c
        sql/src/backends/monet5/merovingian/merovingian_forkmserver.c
        sql/src/backends/monet5/merovingian/merovingian_handlers.c
        sql/src/backends/monet5/merovingian/merovingian_proxy.c
        sql/src/backends/monet5/merovingian/monetdb.1.in
        sql/src/backends/monet5/merovingian/monetdb.c
        sql/src/backends/monet5/merovingian/properties.c
        sql/src/backends/monet5/merovingian/properties.h
        sql/src/backends/monet5/merovingian/utils.c
        sql/src/backends/monet5/merovingian/utils.h
        sql/src/common/sql_backend.mx
        sql/src/common/sql_changeset.mx
        sql/src/common/sql_keyword.mx
        sql/src/common/sql_list.mx
        sql/src/common/sql_mem.mx
        sql/src/common/sql_string.mx
        sql/src/common/sql_types.mx
        sql/src/server/bin_optimizer.mx
        sql/src/server/rel_bin.mx
        sql/src/server/rel_dump.mx
        sql/src/server/rel_exp.mx
        sql/src/server/rel_optimizer.mx
        sql/src/server/rel_prop.mx
        sql/src/server/rel_schema.mx
        sql/src/server/rel_select.mx
        sql/src/server/rel_semantic.mx
        sql/src/server/rel_sequence.mx
        sql/src/server/rel_subquery.mx
        sql/src/server/rel_trans.mx
        sql/src/server/rel_updates.mx
        sql/src/server/rel_xml.mx
        sql/src/server/sql_atom.mx
        sql/src/server/sql_datetime.mx
        sql/src/server/sql_decimal.mx
        sql/src/server/sql_env.mx
        sql/src/server/sql_mvc.mx
        sql/src/server/sql_parser.mx
        sql/src/server/sql_privileges.mx
        sql/src/server/sql_psm.mx
        sql/src/server/sql_qc.mx
        sql/src/server/sql_rel2bin.mx
        sql/src/server/sql_scan.mx
        sql/src/server/sql_schema.mx
        sql/src/server/sql_semantic.mx
        sql/src/server/sql_statement.mx
        sql/src/server/sql_symbol.mx
        sql/src/storage/bat/bat_logger.mx
        sql/src/storage/bat/bat_storage.mx
        sql/src/storage/bat/bat_table.mx
        sql/src/storage/bat/bat_utils.mx
        sql/src/storage/bat/res_table.mx
        sql/src/storage/bpm/bpm_distribution.mx
        sql/src/storage/bpm/bpm_logger.mx
        sql/src/storage/bpm/bpm_storage.mx
        sql/src/storage/bpm/bpm_table.mx
        sql/src/storage/m4/bpm.mx
        sql/src/storage/restrict/restrict_logger.mx
        sql/src/storage/restrict/restrict_storage.mx
        sql/src/storage/restrict/restrict_table.mx
        sql/src/storage/sql_catalog.mx
        sql/src/storage/store.mx
        sql/src/storage/store_connections.mx
        sql/src/storage/store_dependency.mx
        sql/src/storage/store_sequence.mx
Branch: default
Log Message:

merge (hg ...s)


diffs (truncated from 60382 to 300 lines):

diff -r b049416e2d3f -r 88baa725fd26 
sql/src/backends/monet5/merovingian/control.c
--- a/sql/src/backends/monet5/merovingian/control.c     Wed Nov 10 17:09:41 
2010 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * The contents of this file are subject to the MonetDB Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the MonetDB Database System.
- *
- * The Initial Developer of the Original Code is CWI.
- * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2010 MonetDB B.V.
- * All Rights Reserved.
- */
-
-#include "sql_config.h"
-#include "control.h"
-#include <stdio.h>
-#include <stdlib.h> /* malloc, realloc */
-#include <unistd.h> /* close */
-#include <string.h> /* strerror */
-#include <sys/socket.h> /* socket */
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h> /* sockaddr_un */
-#endif
-#include <netdb.h>
-#include <netinet/in.h>
-#include <errno.h>
-
-#define SOCKPTR struct sockaddr *
-
-/* Sends command for database to merovingian listening at host and port.
- * If host is a path, and port is 0, a UNIX socket connection for host
- * is opened.  The response of merovingian is returned as a malloced
- * string.  If wait is set to a non-zero value, this function will only
- * return after it has seen an EOF from the server.  This is useful with
- * multi-line responses, but can lock up for single line responses where
- * the server allows pipelining (and hence doesn't close the
- * connection).
- */
-char* control_send(
-               char** ret,
-               char* host,
-               int port,
-               char* database,
-               char* command,
-               char wait,
-               char* pass)
-{
-       char sbuf[8096];
-       char *buf;
-       int sock = -1;
-       size_t len;
-
-       if (port == -1) {
-               struct sockaddr_un server;
-               /* UNIX socket connect */
-               if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
-                       snprintf(sbuf, sizeof(sbuf), "cannot open connection: 
%s",
-                                       strerror(errno));
-                       return(strdup(sbuf));
-               }
-               memset(&server, 0, sizeof(struct sockaddr_un));
-               server.sun_family = AF_UNIX;
-               strncpy(server.sun_path, host, sizeof(server.sun_path) - 1);
-               if (connect(sock, (SOCKPTR) &server, sizeof(struct 
sockaddr_un))) {
-                       snprintf(sbuf, sizeof(sbuf), "cannot connect: %s", 
strerror(errno));
-                       return(strdup(sbuf));
-               }
-       } else {
-               struct sockaddr_in server;
-               struct hostent *hp;
-
-               /* TCP socket connect */
-               if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
-                       snprintf(sbuf, sizeof(sbuf), "cannot open connection: 
%s",
-                                       strerror(errno));
-                       return(strdup(sbuf));
-               }
-               hp = gethostbyname(host);
-               if (hp == NULL) {
-                       snprintf(sbuf, sizeof(sbuf), "cannot lookup hostname: 
%s",
-                                       strerror(errno));
-                       return(strdup(sbuf));
-               }
-               memset(&server, 0, sizeof(struct sockaddr_in));
-               server.sin_family = hp->h_addrtype;
-               memcpy(&server.sin_addr, hp->h_addr_list[0], hp->h_length);
-               server.sin_port = htons((unsigned short) (port & 0xFFFF));
-               if (connect(sock, (SOCKPTR) &server, sizeof(struct 
sockaddr_in)) < 0) {
-                       snprintf(sbuf, sizeof(sbuf), "cannot connect: %s", 
strerror(errno));
-                       return(strdup(sbuf));
-               }
-               
-               /* perform login ritual */
-               if ((len = recv(sock, sbuf, sizeof(sbuf), 0)) <= 0) {
-                       snprintf(sbuf, sizeof(sbuf), "no response from 
merovingian");
-                       return(strdup(sbuf));
-               }
-               /* we only understand merovingian:1 */
-               if (strncmp(sbuf, "merovingian:1:", strlen("merovingian:1:")) 
!= 0) {
-                       if (len > 2 &&
-                                       (strstr(sbuf + 2, ":BIG:") != NULL ||
-                                        strstr(sbuf + 2, ":LIT:") != NULL))
-                       {
-                               snprintf(sbuf, sizeof(sbuf), "cannot connect: "
-                                               "server looks like a mapi 
server, "
-                                               "are you using merovingian's 
control port (e.g. 50001) "
-                                               "instead of its mapi port (e.g. 
50000)?");
-                       } else {
-                               snprintf(sbuf, sizeof(sbuf), "cannot connect: "
-                                               "unsupported merovingian 
server");
-                       }
-                       return(strdup(sbuf));
-               }
-               buf = strchr(sbuf + strlen("merovingian:1:"), ':');
-               if (buf != NULL)
-                       *buf = '\0';
-               buf = sbuf + strlen("merovingian:1:");
-
-               buf = control_hash(pass, buf);
-
-               len = snprintf(sbuf, sizeof(sbuf), "%s\n", buf);
-               free(buf);
-               send(sock, sbuf, len, 0);
-
-               if ((len = recv(sock, sbuf, sizeof(sbuf), 0)) <= 0)
-                       return(strdup("no response from merovingian"));
-               sbuf[len - 1] = '\0';
-               if (strcmp(sbuf, "OK") != 0)
-                       return(strdup(sbuf));
-       }
-
-       len = snprintf(sbuf, sizeof(sbuf), "%s %s\n", database, command);
-       send(sock, sbuf, len, 0);
-       if (wait != 0) {
-               size_t buflen = sizeof(sbuf);
-               size_t bufpos = 0;
-               char *bufp;
-               bufp = buf = malloc(sizeof(char) * buflen);
-               if (buf == NULL)
-                       return(strdup("failed to allocate memory"));
-               while ((len = recv(sock, buf + bufpos, buflen - bufpos, 0)) > 
0) {
-                       if (len == buflen - bufpos) {
-                               buflen *= 2;
-                               bufp = realloc(buf, sizeof(char) * buflen);
-                               if (bufp == NULL) {
-                                       free(buf);
-                                       return(strdup("failed to allocate more 
memory"));
-                               }
-                               buf = bufp;
-                       }
-                       bufpos += len;
-               }
-               if (bufpos == 0)
-                       return(strdup("no response from merovingian"));
-               buf[bufpos - 1] = '\0';
-               *ret = buf;
-       } else {
-               if ((len = recv(sock, sbuf, sizeof(sbuf), 0)) <= 0)
-                       return(strdup("no response from merovingian"));
-               sbuf[len - 1] = '\0';
-               *ret = strdup(sbuf);
-       }
-
-       close(sock);
-
-       return(NULL);
-}
-
-/**
- * Returns a hash for pass and salt, to use when logging in on a remote
- * merovingian.  The result is a malloced string.
- */
-char *
-control_hash(char *pass, char *salt) {
-       unsigned int ho;
-       unsigned int h = 0;
-       char buf[32];
-
-       /* use a very simple hash function designed for a single int val
-        * (hash buckets), we can make this more interesting if necessary in
-        * the future.
-        * 
http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200101/homework10/hashfuncs.html 
*/
-
-       while (*pass != '\0') {
-               ho = h & 0xf8000000;
-               h <<= 5;
-               h ^= ho >> 27;
-               h ^= (unsigned int)(*pass);
-               pass++;
-       }
-
-       while (*salt != '\0') {
-               ho = h & 0xf8000000;
-               h <<= 5;
-               h ^= ho >> 27;
-               h ^= (unsigned int)(*salt);
-               salt++;
-       }
-
-       snprintf(buf, sizeof(buf), "%u", h);
-       return(strdup(buf));
-}
diff -r b049416e2d3f -r 88baa725fd26 
sql/src/backends/monet5/merovingian/control.h
--- a/sql/src/backends/monet5/merovingian/control.h     Wed Nov 10 17:09:41 
2010 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * The contents of this file are subject to the MonetDB Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the MonetDB Database System.
- *
- * The Initial Developer of the Original Code is CWI.
- * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2010 MonetDB B.V.
- * All Rights Reserved.
- */
-
-#ifndef _SEEN_CONTROL_H
-#define _SEEN_CONTROL_H 1
-
-char* control_send(
-               char** ret,
-               char* host,
-               int port,
-               char* database,
-               char* command,
-               char wait,
-               char* pass);
-char* control_hash(char *pass, char *salt);
-
-#endif
diff -r b049416e2d3f -r 88baa725fd26 
sql/src/backends/monet5/merovingian/database.c
--- a/sql/src/backends/monet5/merovingian/database.c    Wed Nov 10 17:09:41 
2010 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,393 +0,0 @@
-/*
- * The contents of this file are subject to the MonetDB Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the MonetDB Database System.
- *
- * The Initial Developer of the Original Code is CWI.
- * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2010 MonetDB B.V.
- * All Rights Reserved.
- */
-
-/* NOTE: for this file to work correctly, SABAOTHinit must be called. */
-
-#include "sql_config.h"
-#include "mal_sabaoth.h"
-#include <stdio.h> /* fprintf, rename */
-#include <unistd.h> /* stat, rmdir, unlink, ioctl */
-#include <dirent.h> /* readdir */
-#include <sys/stat.h> /* mkdir, stat, umask */
-#include <sys/types.h> /* mkdir, readdir */
-#include <errno.h>
-#include "utils.h"
-
-/* check if dbname matches [A-Za-z0-9-_]+ */
-char* db_validname(char *dbname) {
-       size_t c;
-       char buf[8096];
-
-       if (dbname[0] == '\0')
-               return(strdup("database name should not be an empty string"));
-       for (c = 0; dbname[c] != '\0'; c++) {
-               if (
-                               !(dbname[c] >= 'A' && dbname[c] <= 'Z') &&
-                               !(dbname[c] >= 'a' && dbname[c] <= 'z') &&
-                               !(dbname[c] >= '0' && dbname[c] <= '9') &&
-                               !(dbname[c] == '-') &&
-                               !(dbname[c] == '_')
-                  )
-               {
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to