myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-73-g


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-73-gdb29a2c
Date: Fri, 19 Mar 2010 21:04:54 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  db29a2c07c3144cc89007546c7f558905fc88d4c (commit)
      from  9952d53f7c118789c12edb0bfa946b40b20ff978 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit db29a2c07c3144cc89007546c7f558905fc88d4c
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Mar 19 22:05:13 2010 +0100

    Use the c++defs module from gnulib.

diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index 02a2797..a1db223 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -31,6 +31,7 @@ close
 crypto/md5
 crypto/sha1
 connect
+c++defs
 fsync
 getcwd
 gethostname
@@ -44,6 +45,7 @@ mktime
 nproc
 open
 pipe
+read
 read-file
 readlink
 recv
diff --git a/myserver/configure.ac b/myserver/configure.ac
index 572c3f9..b12c2aa 100644
--- a/myserver/configure.ac
+++ b/myserver/configure.ac
@@ -49,6 +49,8 @@ LT_INIT
 
 AC_DEFINE([WINVER], [0x0501], [WINVER])
 
+AC_DEFINE([GNULIB_NAMESPACE], [gnulib], [GNULIB_NAMESPACE])
+
 LT_INIT
 
 AC_CANONICAL_HOST
diff --git a/myserver/include/base/string/stringutils.h 
b/myserver/include/base/string/stringutils.h
index 214d44c..968d962 100644
--- a/myserver/include/base/string/stringutils.h
+++ b/myserver/include/base/string/stringutils.h
@@ -23,10 +23,7 @@
 # include "myserver.h"
 # include <string>
 
-extern "C"
-{
 # include <string.h>
-}
 
 using namespace std;
 
diff --git a/myserver/include/base/unix_socket/unix_socket.h 
b/myserver/include/base/unix_socket/unix_socket.h
index b7cedc2..dba2bc1 100644
--- a/myserver/include/base/unix_socket/unix_socket.h
+++ b/myserver/include/base/unix_socket/unix_socket.h
@@ -22,16 +22,12 @@
 # include "myserver.h"
 # include <include/base/socket/socket.h>
 
-
-extern "C"
-{
 # ifdef WIN32
-#  undef AF_UNIX //This shouldn't happen, but better be sure.
+#  undef AF_UNIX /* This shouldn't happen, but better be sure.  */
 # else
+#  include <string.h>
 #  include <sys/un.h>
 # endif
-}
-
 
 class UnixSocket: public Socket
 {
@@ -55,12 +51,7 @@ protected:
 
 private:
 # ifdef AF_UNIX
-  void makeAddrInfo (sockaddr_un *info, const char *path)
-  {
-    memset (info, 0, sizeof (struct sockaddr_un));
-    info->sun_family = AF_UNIX;
-    strcpy (info->sun_path, path);
-  }
+  void makeAddrInfo (sockaddr_un *info, const char *path);
 # endif
 };
 
diff --git a/myserver/include/protocol/ftp/ftp_lexer.h 
b/myserver/include/protocol/ftp/ftp_lexer.h
index 5123dbf..e85448f 100644
--- a/myserver/include/protocol/ftp/ftp_lexer.h
+++ b/myserver/include/protocol/ftp/ftp_lexer.h
@@ -97,15 +97,15 @@ typedef unsigned int flex_uint32_t;
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
-#else   /* ! __cplusplus */
+#else  /* ! __cplusplus */
 
 /* C99 requires __STDC__ to be defined as 1. */
 #if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif  /* defined (__STDC__) */
-#endif  /* ! __cplusplus */
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
 #define yyconst const
@@ -156,52 +156,52 @@ typedef size_t yy_size_t;
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
-{
-  FILE *yy_input_file;
-
-  char *yy_ch_buf;              /* input buffer */
-  char *yy_buf_pos;             /* current position in input buffer */
-
-  /* Size of input buffer in bytes, not including room for EOB
-   * characters.
-   */
-  yy_size_t yy_buf_size;
-
-  /* Number of characters read into yy_ch_buf, not including EOB
-   * characters.
-   */
-  int yy_n_chars;
-
-  /* Whether we "own" the buffer - i.e., we know we created it,
-   * and can realloc() it to grow it, and should free() it to
-   * delete it.
-   */
-  int yy_is_our_buffer;
-
-  /* Whether this is an "interactive" input source; if so, and
-   * if we're using stdio for input, then we want to use getc()
-   * instead of fread(), to make sure we stop fetching input after
-   * each newline.
-   */
-  int yy_is_interactive;
-
-  /* Whether we're considered to be at the beginning of a line.
-   * If so, '^' rules will be active on the next match, otherwise
-   * not.
-   */
-  int yy_at_bol;
-
-  int yy_bs_lineno; /**< The line count. */
-  int yy_bs_column; /**< The column count. */
+       {
+       FILE *yy_input_file;
+
+       char *yy_ch_buf;                /* input buffer */
+       char *yy_buf_pos;               /* current position in input buffer */
+
+       /* Size of input buffer in bytes, not including room for EOB
+        * characters.
+        */
+       yy_size_t yy_buf_size;
+
+       /* Number of characters read into yy_ch_buf, not including EOB
+        * characters.
+        */
+       int yy_n_chars;
+
+       /* Whether we "own" the buffer - i.e., we know we created it,
+        * and can realloc() it to grow it, and should free() it to
+        * delete it.
+        */
+       int yy_is_our_buffer;
+
+       /* Whether this is an "interactive" input source; if so, and
+        * if we're using stdio for input, then we want to use getc()
+        * instead of fread(), to make sure we stop fetching input after
+        * each newline.
+        */
+       int yy_is_interactive;
+
+       /* Whether we're considered to be at the beginning of a line.
+        * If so, '^' rules will be active on the next match, otherwise
+        * not.
+        */
+       int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
     
-  /* Whether to try to fill the input buffer when we reach the
-   * end of it.
-   */
-  int yy_fill_buffer;
+       /* Whether to try to fill the input buffer when we reach the
+        * end of it.
+        */
+       int yy_fill_buffer;
 
-  int yy_buffer_status;
+       int yy_buffer_status;
 
-};
+       };
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
 void yyrestart (FILE *input_file ,yyscan_t yyscanner );
@@ -284,9 +284,9 @@ YYSTYPE * yyget_lval (yyscan_t yyscanner );
 
 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
 
-YYLTYPE *yyget_lloc (yyscan_t yyscanner );
+       YYLTYPE *yyget_lloc (yyscan_t yyscanner );
     
-void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+        void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
     
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -334,10 +334,10 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t 
yyscanner);
 #define YY_DECL_IS_OURS 1
 
 extern int yylex \
-(YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
+               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t 
yyscanner);
 
-#define YY_DECL int yylex                                               \
-  (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
+#define YY_DECL int yylex \
+               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t 
yyscanner)
 #endif /* !YY_DECL */
 
 /* yy_get_previous_state - get the state just before the EOB char was reached 
*/
diff --git a/myserver/include/protocol/ftp/ftp_parser.h 
b/myserver/include/protocol/ftp/ftp_parser.h
index 13e0c20..ba8617b 100644
--- a/myserver/include/protocol/ftp/ftp_parser.h
+++ b/myserver/include/protocol/ftp/ftp_parser.h
@@ -3,8 +3,8 @@
 
 /* Skeleton interface for Bison's Yacc-like parsers in C
    
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2010 Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -36,49 +36,49 @@
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-/* Put the tokens into the symbol table, so that GDB and other debuggers
-   know about them.  */
-enum yytokentype {
-  NUMBER_FTP_ARG = 258,
-  STRING_FTP_ARG = 259,
-  CHAR_FTP_ARG = 260,
-  CRLF_FTP_SEP = 261,
-  SPACE_FTP_SEP = 262,
-  PUNCT_FTP_SEP = 263,
-  USER_FTP_COMMAND = 264,
-  PASS_FTP_COMMAND = 265,
-  QUIT_FTP_COMMAND = 266,
-  PORT_FTP_COMMAND = 267,
-  PASV_FTP_COMMAND = 268,
-  MODE_FTP_COMMAND = 269,
-  TYPE_FTP_COMMAND = 270,
-  STRU_FTP_COMMAND = 271,
-  REST_FTP_COMMAND = 272,
-  RETR_FTP_COMMAND = 273,
-  LIST_FTP_COMMAND = 274,
-  NLST_FTP_COMMAND = 275,
-  ABOR_FTP_COMMAND = 276,
-  CWD_FTP_COMMAND = 277,
-  CDUP_FTP_COMMAND = 278,
-  PWD_FTP_COMMAND = 279,
-  ALLO_FTP_COMMAND = 280,
-  STOR_FTP_COMMAND = 281,
-  STOU_FTP_COMMAND = 282,
-  DELE_FTP_COMMAND = 283,
-  APPE_FTP_COMMAND = 284,
-  MKD_FTP_COMMAND = 285,
-  RMD_FTP_COMMAND = 286,
-  RNFR_FTP_COMMAND = 287,
-  RNTO_FTP_COMMAND = 288,
-  HELP_FTP_COMMAND = 289,
-  SYST_FTP_COMMAND = 290,
-  STAT_FTP_COMMAND = 291,
-  NOOP_FTP_COMMAND = 292,
-  SITE_FTP_COMMAND = 293,
-  CHMOD_FTP_COMMAND = 294,
-  UTIME_FTP_COMMAND = 295,
-  SIZE_FTP_COMMAND = 296
-};
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     NUMBER_FTP_ARG = 258,
+     STRING_FTP_ARG = 259,
+     CHAR_FTP_ARG = 260,
+     CRLF_FTP_SEP = 261,
+     SPACE_FTP_SEP = 262,
+     PUNCT_FTP_SEP = 263,
+     USER_FTP_COMMAND = 264,
+     PASS_FTP_COMMAND = 265,
+     QUIT_FTP_COMMAND = 266,
+     PORT_FTP_COMMAND = 267,
+     PASV_FTP_COMMAND = 268,
+     MODE_FTP_COMMAND = 269,
+     TYPE_FTP_COMMAND = 270,
+     STRU_FTP_COMMAND = 271,
+     REST_FTP_COMMAND = 272,
+     RETR_FTP_COMMAND = 273,
+     LIST_FTP_COMMAND = 274,
+     NLST_FTP_COMMAND = 275,
+     ABOR_FTP_COMMAND = 276,
+     CWD_FTP_COMMAND = 277,
+     CDUP_FTP_COMMAND = 278,
+     PWD_FTP_COMMAND = 279,
+     ALLO_FTP_COMMAND = 280,
+     STOR_FTP_COMMAND = 281,
+     STOU_FTP_COMMAND = 282,
+     DELE_FTP_COMMAND = 283,
+     APPE_FTP_COMMAND = 284,
+     MKD_FTP_COMMAND = 285,
+     RMD_FTP_COMMAND = 286,
+     RNFR_FTP_COMMAND = 287,
+     RNTO_FTP_COMMAND = 288,
+     HELP_FTP_COMMAND = 289,
+     SYST_FTP_COMMAND = 290,
+     STAT_FTP_COMMAND = 291,
+     NOOP_FTP_COMMAND = 292,
+     SITE_FTP_COMMAND = 293,
+     CHMOD_FTP_COMMAND = 294,
+     UTIME_FTP_COMMAND = 295,
+     SIZE_FTP_COMMAND = 296
+   };
 #endif
 /* Tokens.  */
 #define NUMBER_FTP_ARG 258
@@ -128,18 +128,18 @@ enum yytokentype {
 typedef union YYSTYPE
 {
 
-  /* Line 1676 of yacc.c  */
-# line 15 "ftp_parser.ypp"
+/* Line 1676 of yacc.c  */
+#line 16 "ftp_parser.ypp"
 
-  int           m_nInt;
-  char          m_nChar;
-  char          m_szStr[PARSER_STR_LEN];
-  FtpHost       m_host;
+  int          m_nInt;
+  char         m_nChar;
+  char         m_szStr[PARSER_STR_LEN];
+  FtpHost      m_host;
 
 
 
-  /* Line 1676 of yacc.c  */
-# line 143 "../../../include/protocol/ftp/ftp_parser.h"
+/* Line 1676 of yacc.c  */
+#line 143 "../../../include/protocol/ftp/ftp_parser.h"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/myserver/lib/Makefile.am b/myserver/lib/Makefile.am
index 33f45d3..891dd40 100644
--- a/myserver/lib/Makefile.am
+++ b/myserver/lib/Makefile.am
@@ -47,6 +47,5 @@ GNULIB_RECVFROM=1
 GNULIB_SENDTO=1
 GNULIB_SETSOCKOPT=1
 GNULIB_SHUTDOWN=1
-GNULIB_ACCEPT4=1
 
 include gnulib.mk
diff --git a/myserver/src/base/base64/mime_utils.cpp 
b/myserver/src/base/base64/mime_utils.cpp
index 390fbb8..4a2bf96 100644
--- a/myserver/src/base/base64/mime_utils.cpp
+++ b/myserver/src/base/base64/mime_utils.cpp
@@ -27,9 +27,10 @@ extern "C"
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 }
 
+#include <string.h>
+
 #include <include/base/string/stringutils.h>
 #include <include/base/string/securestr.h>
 
@@ -258,7 +259,7 @@ char* CBase64Utils::mimeDecodeMailHeaderField (char *s)
     if (start != NULL) alloclen +=static_cast<int>(strlen (start));
     if (rest != NULL) alloclen +=static_cast<int>(strlen (rest));
     alloclen *= sizeof (char);
-    s = (char*)realloc (s, alloclen);
+    s = (char*)gnulib::realloc (s, alloclen);
     s[0] = '\0';
     if (start != NULL)
     {
@@ -547,7 +548,7 @@ char* CQPUtils::expandBuffer (char *buffer, int UsedSize, 
int *BufSize,
   if (UsedSize >= *BufSize - AddVal)
   {
     *BufSize += BufAdd;
-    return (char*)realloc (buffer, *BufSize * sizeof (char));
+    return (char*)gnulib::realloc (buffer, *BufSize * sizeof (char));
   }
   return buffer;
 }
@@ -580,7 +581,7 @@ char* CQPUtils::encode (char *input)
       }
       finalresult = expandBuffer (finalresult, UsedSize, &BufSize, 0);
 
-      snprintf (mids, 3, "%X", mid);
+      gnulib::snprintf (mids, 3, "%X", mid);
 
       myserver_strupr (mids);
       *(fresult++) = '=';
diff --git a/myserver/src/base/crypt/crypt_algo_manager.cpp 
b/myserver/src/base/crypt/crypt_algo_manager.cpp
index f9472d7..3ee5759 100644
--- a/myserver/src/base/crypt/crypt_algo_manager.cpp
+++ b/myserver/src/base/crypt/crypt_algo_manager.cpp
@@ -106,7 +106,7 @@ CryptAlgoManager::check (const char *value, size_t 
valueLen, const char *result,
   CryptAlgo *f = make (algo);
   if (!f)
     {
-      snprintf (buffer, bufferLen, _("%s is not a registered algorithm"),
+      gnulib::snprintf (buffer, bufferLen, _("%s is not a registered 
algorithm"),
                 algo);
       throw CryptAlgoManagerException (buffer);
     }
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index d0c4eca..93fb3cf 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -99,7 +99,7 @@ int File::writeToFile (const char* buffer, u_long buffersize, 
u_long* nbw)
     return -1;
   }
 
-  ret = ::write (handle, buffer, buffersize);
+  ret = gnulib::write (handle, buffer, buffersize);
   if (ret < 0)
     return ret;
 
@@ -162,9 +162,9 @@ int File::openFile (const char* nfilename, u_long opt)
     flags |= O_APPEND;
 
   if (exists)
-    handle = open (filename.c_str (), O_APPEND | flags);
+    handle = gnulib::open (filename.c_str (), O_APPEND | flags);
   else
-    handle = open (filename.c_str (), O_CREAT | flags, S_IRUSR | S_IWUSR);
+    handle = gnulib::open (filename.c_str (), O_CREAT | flags, S_IRUSR | 
S_IWUSR);
 
   try
     {
@@ -176,7 +176,7 @@ int File::openFile (const char* nfilename, u_long opt)
           }
  
       if (opt & File::TEMPORARY)
-        if (unlink (filename.c_str ()))
+        if (gnulib::unlink (filename.c_str ()))
           {
             close ();
             return -1;
@@ -268,9 +268,9 @@ int File::close ()
   if (handle != -1)
     {
       if (opt & File::TEMPORARY_DELAYED)
-        unlink (filename.c_str ());
-      ret = fsync (handle);
-      ret |= ::close (handle);
+        gnulib::unlink (filename.c_str ());
+      ret = gnulib::fsync (handle);
+      ret |= gnulib::close (handle);
     }
 
   filename.clear ();
@@ -287,7 +287,7 @@ u_long File::getFileSize ()
 {
   u_long ret;
   struct stat fStats;
-  ret = fstat (handle, &fStats);
+  ret = gnulib::fstat (handle, &fStats);
   if (ret)
     return (u_long)(-1);
   else
@@ -357,7 +357,7 @@ int File::write (const char* buffer, u_long len, u_long 
*nbw)
  */
 int File::read (char* buffer, u_long buffersize, u_long* nbr)
 {
-  int ret  = ::read (handle, buffer, buffersize);
+  int ret = ::read (handle, buffer, buffersize);
   if (ret < 0)
     return ret;
 
diff --git a/myserver/src/base/file/files_utility.cpp 
b/myserver/src/base/file/files_utility.cpp
index 4915950..61c4a88 100644
--- a/myserver/src/base/file/files_utility.cpp
+++ b/myserver/src/base/file/files_utility.cpp
@@ -142,7 +142,7 @@ int FilesUtility::getPathRecursionLevel (const char* path)
  */
 int FilesUtility::renameFile (const char* before, const char* after)
 {
-  return rename (before, after);
+  return gnulib::rename (before, after);
 }
 
 /*!
@@ -215,7 +215,7 @@ int FilesUtility::copyFile (File& src, File& dest)
 int FilesUtility::deleteFile (const char *filename)
 {
   int ret;
-  ret = remove (filename);
+  ret = gnulib::remove (filename);
 
   if (ret && errno == ENOENT)
     ret = 0;
@@ -255,7 +255,7 @@ int FilesUtility::isLink (const char* filename)
   return 0;
 #else
   struct stat F_Stats;
-  int ret = lstat (filename, &F_Stats);
+  int ret = gnulib::lstat (filename, &F_Stats);
   if (ret < 0)
     return 0;
 
@@ -362,8 +362,8 @@ time_t FilesUtility::getLastAccTime (const char *filename)
 int FilesUtility::chown (const char* filename, string &uid, string &gid)
 {
 #ifndef WIN32
-  return ::chown (filename, Process::getUid (uid.c_str ()),
-                  Process::getGid (gid.c_str ())) ? 1 : 0;
+  return gnulib::chown (filename, Process::getUid (uid.c_str ()),
+                        Process::getGid (gid.c_str ())) ? 1 : 0;
 #endif
   return 0;
 }
@@ -574,7 +574,7 @@ int FilesUtility::getShortFileName (char *filePath, char 
*out, int buffersize)
  * Return non-zero on errors.
  * \param fileName The buffer to use.
  * \param size The new buffer size.
- * \param dontRealloc Don't realloc a new buffer.
+ * \param dontRealloc Don't gnulib::realloc a new buffer.
  */
 int FilesUtility::completePath (char **fileName, int *size, int dontRealloc)
 {
@@ -695,7 +695,7 @@ int FilesUtility::mkdir (const char *path)
 #ifdef WIN32
   return CreateDirectory (path, NULL) ? 0 : -1;
 #else
-  return ::mkdir (path, S_IRUSR | S_IWUSR);
+  return gnulib::mkdir (path, S_IRUSR | S_IWUSR);
 #endif
 }
 
@@ -709,7 +709,7 @@ int FilesUtility::rmdir (const char *path)
 #ifdef WIN32
   return RemoveDirectory (path) ? 0 : -1;
 #else
-  return ::rmdir (path);
+  return gnulib::rmdir (path);
 #endif
 }
 
diff --git a/myserver/src/base/mem_buff/mem_buff.cpp 
b/myserver/src/base/mem_buff/mem_buff.cpp
index fa4eba2..44e1e43 100644
--- a/myserver/src/base/mem_buff/mem_buff.cpp
+++ b/myserver/src/base/mem_buff/mem_buff.cpp
@@ -126,7 +126,7 @@ MemBuf::MemBuf (const void* pAdr, u_int size)
 
 /*!
  * Direct copy constructor (should only be used by the operators to
- * avoid reallocations).
+ * avoid gnulib::reallocations).
  */
 MemBuf::MemBuf (const MemBuf& srcBuf)
 {
@@ -158,7 +158,7 @@ u_int MemBuf::find (char c, u_int start)
 {
   if (start >= nSize)
     return (u_int) -1;
-  void* pFound = memchr (buffer + start, c, nSize - start);
+  void* pFound = gnulib::memchr (buffer + start, c, nSize - start);
 
   return (pFound == NULL) ? (u_int) -1 : ((char*) pFound - buffer);
 }
@@ -174,7 +174,7 @@ u_int MemBuf::find (const void* pAdr, u_int size, u_int 
start)
   const char* pPrev = buffer + start;
   u_int size_buf = nSize - start;
   const char* pEnd = buffer + nSize + 1;
-  while ((pLast = (char*) memchr (pPrev, first, size_buf)) != NULL)
+  while ((pLast = (char*) gnulib::memchr (pPrev, first, size_buf)) != NULL)
     {
       size_buf -= (u_int)(pLast - pPrev);
       pPrev = pLast + 1;
@@ -202,9 +202,9 @@ void MemBuf::replace (char what, char by)
 
 /*!
  * Add a buffer at the end of the internal buffer.
- * If the internal buffer isn't large enough, a reallocation is done
+ * If the internal buffer isn't large enough, a gnulib::reallocation is done
  * until nSizeLimit is reached.
- * If nSizeLimit is equal to 0, reallocation are always done.
+ * If nSizeLimit is equal to 0, gnulib::reallocation are always done.
  */
 void MemBuf::addBuffer (const void* pAdr, u_int size)
 {
@@ -330,8 +330,8 @@ int MemBuf::getPartAsString (u_int nStart, u_int nEnd, 
MemBuf& result)
  * at least newSize bytes, if this value is bigger than nSizeLimit
  * then the latter is used.
  *
- * If the length is smallest than the existing one, no reallocation is done.
- * if it's biggest, a reallocation is done until nSizeLimit is reached.
+ * If the length is smallest than the existing one, no gnulib::reallocation is 
done.
+ * if it's biggest, a gnulib::reallocation is done until nSizeLimit is reached.
  */
 void MemBuf::setRealLength (u_int newSize)
 {
@@ -361,7 +361,7 @@ void MemBuf::setRealLength (u_int newSize)
 
 /*!
  * Set the cursor in the internal buffer.
- * If the specified position is bigger than the buffer size then a reallocation
+ * If the specified position is bigger than the buffer size then a 
gnulib::reallocation
  * is done.
  */
 void MemBuf::setLength (u_int newSize)
diff --git a/myserver/src/base/pipe/pipe.cpp b/myserver/src/base/pipe/pipe.cpp
index bb3b5bb..62256e5 100644
--- a/myserver/src/base/pipe/pipe.cpp
+++ b/myserver/src/base/pipe/pipe.cpp
@@ -146,7 +146,7 @@ int Pipe::write (const char* buffer, u_long len, u_long 
*nbw)
 {
   *nbw = 0;
 #ifndef WIN32
-  int ret = ::write (handles[1], buffer, len);
+  int ret = gnulib::write (handles[1], buffer, len);
   if (ret == -1)
     {
       terminated = true;
@@ -193,9 +193,9 @@ int Pipe::close ()
   terminated = true;
 #ifndef WIN32
   if (handles[0] >= 0)
-    ::close (handles[0]);
+    gnulib::close (handles[0]);
   if (handles[1] >= 0)
-    ::close (handles[1]);
+    gnulib::close (handles[1]);
 
   handles[0] = handles[1] = -1;
 #else
@@ -234,8 +234,8 @@ private:
 void Pipe::inverted (Pipe& pipe)
 {
 #ifndef WIN32
-  pipe.handles[0] = dup (handles[1]);
-  pipe.handles[1] = dup (handles[0]);
+  pipe.handles[0] = gnulib::dup (handles[1]);
+  pipe.handles[1] = gnulib::dup (handles[0]);
   if (pipe.handles[0] < 0 || pipe.handles[1] < 0)
     {
       string err (_("Internal error"));
@@ -277,7 +277,7 @@ void Pipe::closeRead ()
   terminated = true;
 #ifndef WIN32
   if (handles[0] >= 0)
-    ::close (handles[0]);
+    gnulib::close (handles[0]);
   handles[0] = -1;
 #else
   if (readHandle >= 0)
@@ -294,7 +294,7 @@ void Pipe::closeWrite ()
   terminated = true;
 #ifndef WIN32
   if (handles[1] >= 0)
-    ::close (handles[1]);
+    gnulib::close (handles[1]);
   handles[1] = -1;
 #else
   if (writeHandle >= 0)
@@ -343,7 +343,7 @@ int Pipe::waitForData (int sec, int usec)
 
   FD_SET (handles[0], &readfds);
 
-  ret = ::select (handles[0] + 1, &readfds, NULL, NULL, &tv);
+  ret = gnulib::select (handles[0] + 1, &readfds, NULL, NULL, &tv);
 
   if (ret == -1 || ret == 0)
     return 0;
diff --git a/myserver/src/base/process/fork_server.cpp 
b/myserver/src/base/process/fork_server.cpp
index e0c975f..6285a07 100644
--- a/myserver/src/base/process/fork_server.cpp
+++ b/myserver/src/base/process/fork_server.cpp
@@ -207,13 +207,13 @@ int ForkServer::handleRequest (Socket *sock)
   delete [] chroot;
 
   if (flags & FLAG_USE_IN)
-    close (stdIn);
+    gnulib::close (stdIn);
 
   if (flags & FLAG_USE_OUT)
-    close (stdOut);
+    gnulib::close (stdOut);
 
   if (flags & FLAG_USE_ERR)
-    close (stdErr);
+    gnulib::close (stdErr);
 #endif
 
   return 0;
diff --git a/myserver/src/base/process/process.cpp 
b/myserver/src/base/process/process.cpp
index a167f6c..0f8c542 100644
--- a/myserver/src/base/process/process.cpp
+++ b/myserver/src/base/process/process.cpp
@@ -267,29 +267,28 @@ int Process::exec (StartProcInfo* spi, bool waitEnd)
         exit (1);
 
       if ((long)spi->stdOut == -1)
-        spi->stdOut = (FileHandle)open ("/dev/null", O_WRONLY);
+        spi->stdOut = gnulib::open ("/dev/null", O_WRONLY);
 
       if ((long)spi->stdError == -1)
-        spi->stdError = (FileHandle)open ("/dev/null", O_WRONLY);
+        spi->stdError = gnulib::open ("/dev/null", O_WRONLY);
 
-      close (0);
+      gnulib::close (0);
 
       if (spi->stdIn != -1)
         {
-          if (dup2 (spi->stdIn, 0) == -1)
+          if (gnulib::dup2 (spi->stdIn, 0) == -1)
             exit (1);
-          close (spi->stdIn);
+          gnulib::close (spi->stdIn);
         }
 
-      close (1);
+      gnulib::close (1);
 
-      if (dup2 (spi->stdOut, 1) == -1)
+      if (gnulib::dup2 (spi->stdOut, 1) == -1)
         exit (1);
 
+      gnulib::close (2);
 
-      close (2);
-
-      if (dup2 (spi->stdError, 2) == -1)
+      if (gnulib::dup2 (spi->stdError, 2) == -1)
         exit (1);
 
       if (spi->handlesToClose)
@@ -297,7 +296,7 @@ int Process::exec (StartProcInfo* spi, bool waitEnd)
           FileHandle* h = spi->handlesToClose;
           while (*h)
             {
-              close (*h);
+              gnulib::close (*h);
               h++;
             }
         }
diff --git a/myserver/src/base/read_directory/read_directory.cpp 
b/myserver/src/base/read_directory/read_directory.cpp
index 8e379b0..40d9e03 100644
--- a/myserver/src/base/read_directory/read_directory.cpp
+++ b/myserver/src/base/read_directory/read_directory.cpp
@@ -134,7 +134,7 @@ int ReadDirectory::find (const char *filename)
        if (dirName[dirName.length () - 1] == '/')
          dirName.erase (dirName.length () - 1);
 
-       dh = opendir (dirName.c_str ());
+       dh = gnulib::opendir (dirName.c_str ());
 
        if (dh == NULL)
          return -1;
@@ -158,7 +158,7 @@ int ReadDirectory::find (const char *filename)
 # endif
 
 # ifdef HAVE_FSTATAT
-   if (fstatat (dirfd (dh), name.c_str (), &stats, 0))
+   if (gnulib::fstatat (dirfd (dh), name.c_str (), &stats, 0))
      return -1;
 # else
    string tempName;
@@ -198,7 +198,7 @@ int ReadDirectory::findclose ()
   if (!dh)
     return -1;
 
-  closedir (dh);
+  gnulib::closedir (dh);
   dh = NULL;
   return 0;
 #endif
diff --git a/myserver/src/base/safetime/safetime.cpp 
b/myserver/src/base/safetime/safetime.cpp
index 5af463e..1d4754d 100644
--- a/myserver/src/base/safetime/safetime.cpp
+++ b/myserver/src/base/safetime/safetime.cpp
@@ -69,7 +69,7 @@ struct tm *myserver_localtime (const time_t *timep, tm* res)
   memcpy (res, localtime (timep), sizeof (tm));
   return res;
 #elif HAVE_LOCALTIME_R
-  return localtime_r (timep, res);
+  return gnulib::localtime_r (timep, res);
 #else
 
   mutex.lock ();
@@ -91,7 +91,7 @@ struct tm *myserver_gmtime (const time_t *timep, tm* res)
   return res;
 
 #elif HAVE_LOCALTIME_R
-  return gmtime_r (timep, res);
+  return gnulib::gmtime_r (timep, res);
 #else
 
   mutex.lock ();
diff --git a/myserver/src/base/socket/socket.cpp 
b/myserver/src/base/socket/socket.cpp
index 27b81f5..0f1409d 100644
--- a/myserver/src/base/socket/socket.cpp
+++ b/myserver/src/base/socket/socket.cpp
@@ -96,7 +96,7 @@ int Socket::operator=(Socket* s)
  */
 int Socket::socket (int af, int type, int protocol)
 {
-  fd = ::socket (af, type, protocol);
+  fd = gnulib::socket (af, type, protocol);
   return fd;
 }
 
@@ -170,7 +170,7 @@ int Socket::bind (MYSERVER_SOCKADDR* sa, int namelen)
       )
     return -1;
 
-  return ::bind (fd, (struct sockaddr*) sa, namelen);
+  return gnulib::bind (fd, (struct sockaddr*) sa, namelen);
 }
 
 /*!
@@ -178,7 +178,7 @@ int Socket::bind (MYSERVER_SOCKADDR* sa, int namelen)
  */
 int Socket::listen (int max)
 {
-  return ::listen (fd, max);
+  return gnulib::listen (fd, max);
 }
 
 /*!
@@ -186,8 +186,8 @@ int Socket::listen (int max)
  */
 Socket* Socket::accept (MYSERVER_SOCKADDR* sa, socklen_t* sockaddrlen)
 {
-  int acceptedHandle = ::accept (fd, (struct sockaddr *)sa,
-                                          sockaddrlen);
+  int acceptedHandle = gnulib::accept (fd, (struct sockaddr *)sa,
+                                       sockaddrlen);
 
   if (acceptedHandle >= 0)
     return new Socket ((SocketHandle) acceptedHandle);
@@ -202,7 +202,7 @@ int Socket::close ()
 {
   int ret = -1;
   if (fd >= 0)
-    ret = ::close (fd);
+    ret = gnulib::close (fd);
 
   fd = -1;
   return ret;
@@ -229,7 +229,7 @@ MYSERVER_HOSTENT *Socket::gethostbyname (const char 
*hostname)
  */
 int Socket::shutdown (int how)
 {
-  return ::shutdown (fd, how);
+  return gnulib::shutdown (fd, how);
 }
 
 /*!
@@ -238,7 +238,7 @@ int Socket::shutdown (int how)
 int  Socket::setsockopt (int level, int optname,
                        const char *optval, int optlen)
 {
-  return ::setsockopt (fd, level, optname, optval, optlen);
+  return gnulib::setsockopt (fd, level, optname, optval, optlen);
 }
 
 /*!
@@ -322,7 +322,7 @@ int Socket::getLocalIPsList (string &out)
  */
 int Socket::rawSend (const char* buffer, int len, int flags)
 {
-  return ::send (fd, buffer, len, flags);
+  return gnulib::send (fd, buffer, len, flags);
 }
 
 /*!
@@ -375,7 +375,7 @@ int Socket::send (const char* buffer, int len, int flags)
  */
 int Socket::ioctlsocket (long cmd, unsigned long* argp)
 {
-  return ::ioctl (fd, cmd, argp);
+  return gnulib::ioctl (fd, cmd, argp);
 }
 
 /*!
@@ -411,7 +411,7 @@ int Socket::connect (const char* host, u_short port)
     }
 
   memset (szPort, 0, sizeof (char)*10);
-  snprintf (szPort, 10, "%d", port);
+  gnulib::snprintf (szPort, 10, "%d", port);
 
   if (aiHints.ai_family != 0)
     nGetaddrinfoRet = getaddrinfo (host, NULL, &aiHints, &pHostInfo);
@@ -523,7 +523,7 @@ int Socket::connect (MYSERVER_SOCKADDR* sa, int na)
  )
     return -1;
 
-  return ::connect (fd, (sockaddr *) sa, na);
+  return gnulib::connect (fd, (sockaddr *) sa, na);
 }
 
 /*!
@@ -550,7 +550,7 @@ int Socket::recv (char* buffer,int len,int flags)
 {
   int err = 0;
 
-  err = ::recv (fd, buffer, len, flags);
+  err = gnulib::recv (fd, buffer, len, flags);
 
   if ( err < 0 && errno == EAGAIN && isNonBlocking)
     return 0;
@@ -595,7 +595,7 @@ int Socket::setNonBlocking (int nonBlocking)
   u_long nonblock = nonBlocking ? 1 : 0;
   ret = ioctlsocket (FIONBIO, &nonblock);
 #else
-  flags = fcntl (fd, F_GETFL, 0);
+  flags = gnulib::fcntl (fd, F_GETFL, 0);
   if (flags < 0)
     return -1;
 
@@ -604,7 +604,7 @@ int Socket::setNonBlocking (int nonBlocking)
   else
     flags &= ~O_NONBLOCK;
 
-  ret = fcntl (fd, F_SETFL, flags);
+  ret = gnulib::fcntl (fd, F_SETFL, flags);
 
   isNonBlocking = nonBlocking ? true : false;
 #endif
@@ -617,7 +617,7 @@ int Socket::setNonBlocking (int nonBlocking)
  */
 int Socket::gethostname (char *name, int namelen)
 {
-  return ::gethostname (name,namelen);
+  return gnulib::gethostname (name,namelen);
 }
 
 /*!
@@ -626,7 +626,7 @@ int Socket::gethostname (char *name, int namelen)
 int Socket::getsockname (MYSERVER_SOCKADDR *ad, int *namelen)
 {
   socklen_t len =(socklen_t) *namelen;
-  int ret = ::getsockname (fd, (struct sockaddr *)ad, &len);
+  int ret = gnulib::getsockname (fd, (struct sockaddr *)ad, &len);
   *namelen = (int)len;
   return ret;
 }
@@ -661,7 +661,7 @@ int Socket::dataAvailable (int sec, int usec)
   FD_ZERO (&readfds);
   FD_SET (fd, &readfds);
 
-  ret = ::select (fd + 1, &readfds, NULL, NULL, &tv);
+  ret = gnulib::select (fd + 1, &readfds, NULL, NULL, &tv);
   if (ret <= 0)
     return 0;
 
diff --git a/myserver/src/base/socket/ssl_socket.cpp 
b/myserver/src/base/socket/ssl_socket.cpp
index ceca2cf..d6e25e8 100644
--- a/myserver/src/base/socket/ssl_socket.cpp
+++ b/myserver/src/base/socket/ssl_socket.cpp
@@ -89,7 +89,7 @@ int SslSocket::shutdown (int how)
   if (sslConnection)
     SSL_shutdown (sslConnection);
 
-  return ::shutdown (fd, how);
+  return gnulib::shutdown (fd, how);
 }
 
 /*!
@@ -133,7 +133,7 @@ int SslSocket::connect (MYSERVER_SOCKADDR* sa, int na)
     return -1;
 
   /*! Do the TCP connection.  */
-  if (::connect (fd, (sockaddr *) sa, na))
+  if (gnulib::connect (fd, (sockaddr *) sa, na))
     {
       SSL_CTX_free (sslContext);
       sslContext = 0;
diff --git a/myserver/src/base/ssl/ssl.cpp b/myserver/src/base/ssl/ssl.cpp
index e175b86..f3b7c43 100644
--- a/myserver/src/base/ssl/ssl.cpp
+++ b/myserver/src/base/ssl/ssl.cpp
@@ -36,7 +36,11 @@ extern "C"
 # endif
 # include <gcrypt.h>
 # if HAVE_PTHREAD
+  /* Hack.  */
+# undef malloc
+# define malloc gnulib::malloc
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
+# undef malloc
 # endif
 #endif
 }
diff --git a/myserver/src/base/string/stringutils.cpp 
b/myserver/src/base/string/stringutils.cpp
index f14c505..c5c3061 100644
--- a/myserver/src/base/string/stringutils.cpp
+++ b/myserver/src/base/string/stringutils.cpp
@@ -311,7 +311,7 @@ time_t getTime (const char* str)
 
   t.tm_isdst = -1;
 
-  return mktime (&t);
+  return gnulib::mktime (&t);
 }
 
 /*!
diff --git a/myserver/src/base/sync/event.cpp b/myserver/src/base/sync/event.cpp
index f93b588..1db107d 100644
--- a/myserver/src/base/sync/event.cpp
+++ b/myserver/src/base/sync/event.cpp
@@ -96,7 +96,7 @@ int Event::wait (u_long id, u_long timeout)
   {
     struct timespec ts;
     struct timeval tp;
-    gettimeofday (&tp, NULL);
+    gnulib::gettimeofday (&tp, NULL);
     ts.tv_sec = tp.tv_sec + tp.tv_usec / 1000000 + timeout / 1000;
     ts.tv_nsec = (tp.tv_usec * 1000 + timeout * 1000000) % 1000000000;
 
diff --git a/myserver/src/base/unix_socket/unix_socket.cpp 
b/myserver/src/base/unix_socket/unix_socket.cpp
index e16eec5..3e76fc3 100644
--- a/myserver/src/base/unix_socket/unix_socket.cpp
+++ b/myserver/src/base/unix_socket/unix_socket.cpp
@@ -20,6 +20,16 @@
 #include <include/base/unix_socket/unix_socket.h>
 #include <include/base/utility.h>
 
+#ifdef AF_UNIX
+void UnixSocket::makeAddrInfo (sockaddr_un *info, const char *path)
+{
+  memset (info, 0, sizeof (struct sockaddr_un));
+  info->sun_family = AF_UNIX;
+  strcpy (info->sun_path, path);
+}
+#endif
+
+
 UnixSocket::UnixSocket ()
 {
 
@@ -42,7 +52,7 @@ int UnixSocket::bind (const char* path)
 
 #ifdef AF_UNIX
   makeAddrInfo (&addr, path);
-  unlink (path);
+  gnulib::unlink (path);
 
   return Socket::bind ((MYSERVER_SOCKADDR*) &addr, sizeof (sockaddr_un));
 #else
@@ -58,7 +68,7 @@ int UnixSocket::shutdown ()
 {
 #ifdef AF_UNIX
   Socket::shutdown (2);
-  return unlink (addr.sun_path);
+  return gnulib::unlink (addr.sun_path);
 #else
   return -1;
 #endif
diff --git a/myserver/src/base/utility.cpp b/myserver/src/base/utility.cpp
index a235e3d..cca09f1 100644
--- a/myserver/src/base/utility.cpp
+++ b/myserver/src/base/utility.cpp
@@ -69,7 +69,7 @@ static int initializeCwd ()
   if (currentPath)
     return 0;
 
-  currentPath = getcwd (NULL, 0);
+  currentPath = gnulib::getcwd (NULL, 0);
   if (!currentPath)
     return -1;
 
@@ -144,7 +144,7 @@ char *getdefaultwd (char *path, int len)
 int setcwd (const char *dir)
 {
   int ret;
-  char *tmp = strdup (dir);
+  char *tmp = gnulib::strdup (dir);
   if (!tmp)
     return -1;
 
@@ -203,7 +203,7 @@ u_long getTicks ()
   return GetTickCount ();
 #else
   struct timeval tval;
-  int ret = gettimeofday (&tval, 0);
+  int ret = gnulib::gettimeofday (&tval, 0);
   if (ret == -1)
     return 0;
   return  (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index 615157f..dc487c3 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -107,13 +107,12 @@ void registerSignals ()
   sig1.sa_handler = SIG_IGN;
   sig2.sa_handler = Sig_Quit;
   sig3.sa_handler = Sig_Hup;
-  sigaction (SIGPIPE, &sig1, NULL);
-  sigaction (SIGINT, &sig2, NULL);
-  sigaction (SIGTERM, &sig2, NULL);
-  sigaction (SIGHUP, &sig3, NULL);
-
+  gnulib::sigaction (SIGPIPE, &sig1, NULL);
+  gnulib::sigaction (SIGINT, &sig2, NULL);
+  gnulib::sigaction (SIGTERM, &sig2, NULL);
+  gnulib::sigaction (SIGHUP, &sig3, NULL);
   /* Avoid zombie processes.  */
-  sigaction (SIGCHLD, &sa, (struct sigaction *)NULL);
+  gnulib::sigaction (SIGCHLD, &sa, (struct sigaction *)NULL);
 #else
   SetConsoleMode (GetStdHandle (STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT);
   SetConsoleCtrlHandler ((PHANDLER_ROUTINE) SignalHandler, TRUE);
@@ -563,18 +562,18 @@ int writePidfile (const char* filename)
       file.append ("/var/run/myserver.pid");
     }
 
-  pidfile = open (filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+  pidfile = gnulib::open (filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
   if (pidfile == -1)
     return -1;
 
   sprintf (buff,"%i\n", pid);
-  ret = write (pidfile, buff, strlen (buff));
+  ret = gnulib::write (pidfile, buff, strlen (buff));
   if (ret == -1)
     {
-      close (pidfile);
+      gnulib::close (pidfile);
       return -1;
     }
-  return close (pidfile);
+  return gnulib::close (pidfile);
 }
 #endif
 
diff --git a/myserver/src/protocol/control/control_protocol.cpp 
b/myserver/src/protocol/control/control_protocol.cpp
index 7bd1736..5be58f9 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -543,7 +543,7 @@ int ControlProtocol::addToLog (int retCode, ConnectionPtr 
con, char *buffer,
 {
   string time;
   getRFC822GMTTime (time, 32);
-  snprintf (buffer, bufferSize, "%s [%s] %s:%s:%s - %s - %i", con->getIpAddr 
(),
+  gnulib::snprintf (buffer, bufferSize, "%s [%s] %s:%s:%s - %s - %i", 
con->getIpAddr (),
             time.c_str (), header.getCommand (), header.getVersion (),
             header.getOptions (), header.getAuthLogin (), retCode);
   con->host->accessesLogWrite ("%s", buffer);
@@ -567,14 +567,14 @@ int ControlProtocol::sendResponse (char *buffer, int 
buffersize,
     dataLength = outFile->getFileSize ();
 
   /* Build and send the first line.  */
-  snprintf (buffer, buffersize, "/%i\r\n", errID);
+  gnulib::snprintf (buffer, buffersize, "/%i\r\n", errID);
   if (a->socket->send (buffer, strlen (buffer), 0) < 0)
     {
       a->host->warningsLogWrite (_("Control: socket error"));
       return -1;
     }
 
-  snprintf (buffer, buffersize, "/LEN %u\r\n", (u_int)dataLength);
+  gnulib::snprintf (buffer, buffersize, "/LEN %u\r\n", (u_int)dataLength);
   if (a->socket->send (buffer, strlen (buffer), 0) < 0)
     {
       a->host->warningsLogWrite (_("Control: socket error"));
@@ -671,7 +671,7 @@ int ControlProtocol::visitConnection (ConnectionPtr con, 
void *argP)
 
   if (arg->command == ControlProtocolVisitorArg::SHOW_CONNECTIONS)
   {
-    snprintf (arg->buffer, arg->bufferSize, "%i - %s - %i - %s - %i - %s - 
%s\r\n",
+    gnulib::snprintf (arg->buffer, arg->bufferSize, "%i - %s - %i - %s - %i - 
%s - %s\r\n",
              static_cast<int>(con->getID ()),  con->getIpAddr (),
              static_cast<int>(con->getPort ()),
              con->getLocalIpAddr (),  static_cast<int>(con->getLocalPort ()),
diff --git a/myserver/src/protocol/ftp/ftp.cpp 
b/myserver/src/protocol/ftp/ftp.cpp
index 10e72c9..2e1a4b9 100644
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -58,7 +58,7 @@ void setFtpHost (FtpHost & out, const FtpHost & in)
 void setFtpHost (FtpHost & out, const char *szIn)
 {
   std::stringstream ss;
-  char *szLocalIn = strdup (szIn);
+  char *szLocalIn = gnulib::strdup (szIn);
   char *tok = strtok (szLocalIn, ",.");
   while (tok != NULL)
     {
diff --git a/myserver/src/protocol/ftp/ftp_lexer.cpp 
b/myserver/src/protocol/ftp/ftp_lexer.cpp
index 32602f6..f938380 100644
--- a/myserver/src/protocol/ftp/ftp_lexer.cpp
+++ b/myserver/src/protocol/ftp/ftp_lexer.cpp
@@ -1,7 +1,23 @@
 /* We need this hack to ensure myserver.h is include before any other file.  */
 #include "myserver.h"
+
+#undef fprintf
+#undef malloc
+#undef realloc
+#undef fwrite
+
+#define fprintf gnulib::fprintf
+#define fwrite gnulib::fwrite
+#define malloc gnulib::malloc
+#define realloc gnulib::realloc
+
 #include "ftp_lexer.out.cpp"
 
+#undef fprintf
+#undef fwrite
+#undef malloc
+#undef realloc
+
 /* Shutup a warning.  */
 void
 ftp_lexer_dummy ()
diff --git a/myserver/src/protocol/ftp/ftp_parser.cpp 
b/myserver/src/protocol/ftp/ftp_parser.cpp
index bedac40..ba64ea1 100644
--- a/myserver/src/protocol/ftp/ftp_parser.cpp
+++ b/myserver/src/protocol/ftp/ftp_parser.cpp
@@ -195,12 +195,12 @@ typedef union YYSTYPE
 {
 
 /* Line 214 of yacc.c  */
-#line 15 "ftp_parser.ypp"
+#line 16 "ftp_parser.ypp"
 
-       int             m_nInt;
-       char            m_nChar;
-       char            m_szStr[PARSER_STR_LEN];
-       FtpHost         m_host;
+  int          m_nInt;
+  char         m_nChar;
+  char         m_szStr[PARSER_STR_LEN];
+  FtpHost      m_host;
 
 
 
@@ -229,13 +229,14 @@ typedef struct YYLTYPE
 /* Copy the second part of user declarations.  */
 
 /* Line 264 of yacc.c  */
-#line 22 "ftp_parser.ypp"
+#line 23 "ftp_parser.ypp"
 
+#define YYSTACK_ALLOC gnulib::malloc
 #define yyscanner pContext->getScanner()
 
 
 /* Line 264 of yacc.c  */
-#line 239 "ftp_parser.cpp"
+#line 240 "ftp_parser.cpp"
 
 #ifdef short
 # undef short
@@ -551,13 +552,13 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,    92,    92,    93,    99,   103,   107,   111,   115,   119,
-     126,   133,   137,   141,   145,   149,   153,   157,   161,   165,
-     169,   173,   177,   181,   185,   189,   193,   197,   201,   205,
-     209,   213,   217,   221,   225,   229,   233,   237,   241,   245,
-     249,   253,   256,   261,   267,   274,   285,   294,   301,   305,
-     309,   315,   319,   323,   329,   333,   337,   341,   347,   351,
-     355
+       0,    94,    94,    95,   101,   105,   109,   113,   117,   121,
+     128,   135,   139,   143,   147,   151,   155,   159,   163,   167,
+     171,   175,   179,   183,   187,   191,   195,   199,   203,   207,
+     211,   215,   219,   223,   227,   231,   235,   239,   243,   247,
+     251,   255,   258,   263,   269,   276,   287,   296,   303,   307,
+     311,   317,   321,   325,   331,   335,   339,   343,   349,   353,
+     357
 };
 #endif
 
@@ -1615,7 +1616,7 @@ yyreduce:
         case 3:
 
 /* Line 1455 of yacc.c  */
-#line 94 "ftp_parser.ypp"
+#line 96 "ftp_parser.ypp"
     {
                        pContext->computeParseLength((yyloc));
                }
@@ -1624,7 +1625,7 @@ yyreduce:
   case 4:
 
 /* Line 1455 of yacc.c  */
-#line 100 "ftp_parser.ypp"
+#line 102 "ftp_parser.ypp"
     {
                        pContext->user((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1633,7 +1634,7 @@ yyreduce:
   case 5:
 
 /* Line 1455 of yacc.c  */
-#line 104 "ftp_parser.ypp"
+#line 106 "ftp_parser.ypp"
     {
                        pContext->password((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1642,7 +1643,7 @@ yyreduce:
   case 6:
 
 /* Line 1455 of yacc.c  */
-#line 108 "ftp_parser.ypp"
+#line 110 "ftp_parser.ypp"
     {
                  pContext->port((yyvsp[(3) - (4)].m_host));
                }
@@ -1651,7 +1652,7 @@ yyreduce:
   case 7:
 
 /* Line 1455 of yacc.c  */
-#line 112 "ftp_parser.ypp"
+#line 114 "ftp_parser.ypp"
     {
                  pContext->pasv();
                }
@@ -1660,7 +1661,7 @@ yyreduce:
   case 8:
 
 /* Line 1455 of yacc.c  */
-#line 116 "ftp_parser.ypp"
+#line 118 "ftp_parser.ypp"
     {
                  pContext->mode((yyvsp[(3) - (4)].m_nInt));
                }
@@ -1669,7 +1670,7 @@ yyreduce:
   case 9:
 
 /* Line 1455 of yacc.c  */
-#line 120 "ftp_parser.ypp"
+#line 122 "ftp_parser.ypp"
     {
       if ((yyvsp[(3) - (4)].m_nInt) == -1)
         pContext->ftpReply(504);
@@ -1681,7 +1682,7 @@ yyreduce:
   case 10:
 
 /* Line 1455 of yacc.c  */
-#line 127 "ftp_parser.ypp"
+#line 129 "ftp_parser.ypp"
     {
       if ((yyvsp[(3) - (6)].m_nInt) == -1 || (yyvsp[(5) - (6)].m_nInt) == -1)
         pContext->ftpReply(504);
@@ -1693,7 +1694,7 @@ yyreduce:
   case 11:
 
 /* Line 1455 of yacc.c  */
-#line 134 "ftp_parser.ypp"
+#line 136 "ftp_parser.ypp"
     {
                  pContext->stru((yyvsp[(3) - (4)].m_nInt));
                }
@@ -1702,7 +1703,7 @@ yyreduce:
   case 12:
 
 /* Line 1455 of yacc.c  */
-#line 138 "ftp_parser.ypp"
+#line 140 "ftp_parser.ypp"
     {
                  pContext->rest((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1711,7 +1712,7 @@ yyreduce:
   case 13:
 
 /* Line 1455 of yacc.c  */
-#line 142 "ftp_parser.ypp"
+#line 144 "ftp_parser.ypp"
     {
                  pContext->allo((yyvsp[(3) - (4)].m_nInt));
                }
@@ -1720,7 +1721,7 @@ yyreduce:
   case 14:
 
 /* Line 1455 of yacc.c  */
-#line 146 "ftp_parser.ypp"
+#line 148 "ftp_parser.ypp"
     {
                  pContext->allo((yyvsp[(3) - (8)].m_nInt), (yyvsp[(7) - 
(8)].m_nInt));
                }
@@ -1729,7 +1730,7 @@ yyreduce:
   case 15:
 
 /* Line 1455 of yacc.c  */
-#line 150 "ftp_parser.ypp"
+#line 152 "ftp_parser.ypp"
     {
                  pContext->retr((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1738,7 +1739,7 @@ yyreduce:
   case 16:
 
 /* Line 1455 of yacc.c  */
-#line 154 "ftp_parser.ypp"
+#line 156 "ftp_parser.ypp"
     {
                        pContext->abor();
                }
@@ -1747,7 +1748,7 @@ yyreduce:
   case 17:
 
 /* Line 1455 of yacc.c  */
-#line 158 "ftp_parser.ypp"
+#line 160 "ftp_parser.ypp"
     {
                  pContext->list();
                }
@@ -1756,7 +1757,7 @@ yyreduce:
   case 18:
 
 /* Line 1455 of yacc.c  */
-#line 162 "ftp_parser.ypp"
+#line 164 "ftp_parser.ypp"
     {
                  pContext->list((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1765,7 +1766,7 @@ yyreduce:
   case 19:
 
 /* Line 1455 of yacc.c  */
-#line 166 "ftp_parser.ypp"
+#line 168 "ftp_parser.ypp"
     {
                  pContext->nlst();
                }
@@ -1774,7 +1775,7 @@ yyreduce:
   case 20:
 
 /* Line 1455 of yacc.c  */
-#line 170 "ftp_parser.ypp"
+#line 172 "ftp_parser.ypp"
     {
                  pContext->nlst((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1783,7 +1784,7 @@ yyreduce:
   case 21:
 
 /* Line 1455 of yacc.c  */
-#line 174 "ftp_parser.ypp"
+#line 176 "ftp_parser.ypp"
     {
                        pContext->cwd((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1792,7 +1793,7 @@ yyreduce:
   case 22:
 
 /* Line 1455 of yacc.c  */
-#line 178 "ftp_parser.ypp"
+#line 180 "ftp_parser.ypp"
     {
                        pContext->cwd("..");
                }
@@ -1801,7 +1802,7 @@ yyreduce:
   case 23:
 
 /* Line 1455 of yacc.c  */
-#line 182 "ftp_parser.ypp"
+#line 184 "ftp_parser.ypp"
     {
                        pContext->pwd();
                }
@@ -1810,7 +1811,7 @@ yyreduce:
   case 24:
 
 /* Line 1455 of yacc.c  */
-#line 186 "ftp_parser.ypp"
+#line 188 "ftp_parser.ypp"
     {
                        pContext->help((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1819,7 +1820,7 @@ yyreduce:
   case 25:
 
 /* Line 1455 of yacc.c  */
-#line 190 "ftp_parser.ypp"
+#line 192 "ftp_parser.ypp"
     {
                        pContext->help();
                }
@@ -1828,7 +1829,7 @@ yyreduce:
   case 26:
 
 /* Line 1455 of yacc.c  */
-#line 194 "ftp_parser.ypp"
+#line 196 "ftp_parser.ypp"
     {
                        pContext->syst();
                }
@@ -1837,7 +1838,7 @@ yyreduce:
   case 27:
 
 /* Line 1455 of yacc.c  */
-#line 198 "ftp_parser.ypp"
+#line 200 "ftp_parser.ypp"
     {
                        pContext->statCmd();
                }
@@ -1846,7 +1847,7 @@ yyreduce:
   case 28:
 
 /* Line 1455 of yacc.c  */
-#line 202 "ftp_parser.ypp"
+#line 204 "ftp_parser.ypp"
     {
                        pContext->quit();
                }
@@ -1855,7 +1856,7 @@ yyreduce:
   case 29:
 
 /* Line 1455 of yacc.c  */
-#line 206 "ftp_parser.ypp"
+#line 208 "ftp_parser.ypp"
     {
                        pContext->noop();
                }
@@ -1864,7 +1865,7 @@ yyreduce:
   case 30:
 
 /* Line 1455 of yacc.c  */
-#line 210 "ftp_parser.ypp"
+#line 212 "ftp_parser.ypp"
     {
                        pContext->ftpReply(502);//any new commands
                }
@@ -1873,7 +1874,7 @@ yyreduce:
   case 31:
 
 /* Line 1455 of yacc.c  */
-#line 214 "ftp_parser.ypp"
+#line 216 "ftp_parser.ypp"
     {
                        pContext->ftpReply(502);//any new commands
                }
@@ -1882,7 +1883,7 @@ yyreduce:
   case 32:
 
 /* Line 1455 of yacc.c  */
-#line 218 "ftp_parser.ypp"
+#line 220 "ftp_parser.ypp"
     {
                        // ignore empty lines
                }
@@ -1891,7 +1892,7 @@ yyreduce:
   case 33:
 
 /* Line 1455 of yacc.c  */
-#line 222 "ftp_parser.ypp"
+#line 224 "ftp_parser.ypp"
     {
                  pContext->stor((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1900,7 +1901,7 @@ yyreduce:
   case 34:
 
 /* Line 1455 of yacc.c  */
-#line 226 "ftp_parser.ypp"
+#line 228 "ftp_parser.ypp"
     {
                  pContext->stou((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1909,7 +1910,7 @@ yyreduce:
   case 35:
 
 /* Line 1455 of yacc.c  */
-#line 230 "ftp_parser.ypp"
+#line 232 "ftp_parser.ypp"
     {
                  pContext->dele((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1918,7 +1919,7 @@ yyreduce:
   case 36:
 
 /* Line 1455 of yacc.c  */
-#line 234 "ftp_parser.ypp"
+#line 236 "ftp_parser.ypp"
     {
                  pContext->appe((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1927,7 +1928,7 @@ yyreduce:
   case 37:
 
 /* Line 1455 of yacc.c  */
-#line 238 "ftp_parser.ypp"
+#line 240 "ftp_parser.ypp"
     {
                  pContext->mkd((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1936,7 +1937,7 @@ yyreduce:
   case 38:
 
 /* Line 1455 of yacc.c  */
-#line 242 "ftp_parser.ypp"
+#line 244 "ftp_parser.ypp"
     {
                  pContext->rmd((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1945,7 +1946,7 @@ yyreduce:
   case 39:
 
 /* Line 1455 of yacc.c  */
-#line 246 "ftp_parser.ypp"
+#line 248 "ftp_parser.ypp"
     {
                  pContext->rnfr((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1954,7 +1955,7 @@ yyreduce:
   case 40:
 
 /* Line 1455 of yacc.c  */
-#line 250 "ftp_parser.ypp"
+#line 252 "ftp_parser.ypp"
     {
                  pContext->Rnto((yyvsp[(3) - (4)].m_szStr));
                }
@@ -1963,7 +1964,7 @@ yyreduce:
   case 41:
 
 /* Line 1455 of yacc.c  */
-#line 254 "ftp_parser.ypp"
+#line 256 "ftp_parser.ypp"
     {
                }
     break;
@@ -1971,7 +1972,7 @@ yyreduce:
   case 42:
 
 /* Line 1455 of yacc.c  */
-#line 257 "ftp_parser.ypp"
+#line 259 "ftp_parser.ypp"
     {
                        //pContext->Chmod($3, $5);
                        pContext->ftpReply(502);
@@ -1981,7 +1982,7 @@ yyreduce:
   case 43:
 
 /* Line 1455 of yacc.c  */
-#line 262 "ftp_parser.ypp"
+#line 264 "ftp_parser.ypp"
     {
                        //pContext->Utime($3, $5);
                        pContext->ftpReply(502);
@@ -1991,7 +1992,7 @@ yyreduce:
   case 44:
 
 /* Line 1455 of yacc.c  */
-#line 268 "ftp_parser.ypp"
+#line 270 "ftp_parser.ypp"
     {
                        pContext->size((yyvsp[(3) - (4)].m_szStr));
                }
@@ -2000,7 +2001,7 @@ yyreduce:
   case 45:
 
 /* Line 1455 of yacc.c  */
-#line 275 "ftp_parser.ypp"
+#line 277 "ftp_parser.ypp"
     {
                  (yyval.m_host).h1 = (yyvsp[(1) - (3)].m_host).h1;
                  (yyval.m_host).h2 = (yyvsp[(1) - (3)].m_host).h2;
@@ -2014,7 +2015,7 @@ yyreduce:
   case 46:
 
 /* Line 1455 of yacc.c  */
-#line 286 "ftp_parser.ypp"
+#line 288 "ftp_parser.ypp"
     {
                  (yyval.m_host).h1 = (yyvsp[(1) - (7)].m_nInt);
                  (yyval.m_host).h2 = (yyvsp[(3) - (7)].m_nInt);
@@ -2026,7 +2027,7 @@ yyreduce:
   case 47:
 
 /* Line 1455 of yacc.c  */
-#line 295 "ftp_parser.ypp"
+#line 297 "ftp_parser.ypp"
     {
                  (yyval.m_host).p1 = (yyvsp[(1) - (3)].m_nInt);
                  (yyval.m_host).p2 = (yyvsp[(3) - (3)].m_nInt);
@@ -2036,7 +2037,7 @@ yyreduce:
   case 48:
 
 /* Line 1455 of yacc.c  */
-#line 302 "ftp_parser.ypp"
+#line 304 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = FtpuserData::MODE_STREAM;
                }
@@ -2045,7 +2046,7 @@ yyreduce:
   case 49:
 
 /* Line 1455 of yacc.c  */
-#line 306 "ftp_parser.ypp"
+#line 308 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = -1;
                }
@@ -2054,7 +2055,7 @@ yyreduce:
   case 50:
 
 /* Line 1455 of yacc.c  */
-#line 310 "ftp_parser.ypp"
+#line 312 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = -1;
                }
@@ -2063,7 +2064,7 @@ yyreduce:
   case 51:
 
 /* Line 1455 of yacc.c  */
-#line 316 "ftp_parser.ypp"
+#line 318 "ftp_parser.ypp"
     {
                        (yyval.m_nInt) = FtpuserData::STRU_FILE;
                }
@@ -2072,7 +2073,7 @@ yyreduce:
   case 52:
 
 /* Line 1455 of yacc.c  */
-#line 320 "ftp_parser.ypp"
+#line 322 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = -1;
                }
@@ -2081,7 +2082,7 @@ yyreduce:
   case 53:
 
 /* Line 1455 of yacc.c  */
-#line 324 "ftp_parser.ypp"
+#line 326 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = -1;
                }
@@ -2090,7 +2091,7 @@ yyreduce:
   case 54:
 
 /* Line 1455 of yacc.c  */
-#line 330 "ftp_parser.ypp"
+#line 332 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = FtpuserData::REPR_ASCII;
                }
@@ -2099,7 +2100,7 @@ yyreduce:
   case 55:
 
 /* Line 1455 of yacc.c  */
-#line 334 "ftp_parser.ypp"
+#line 336 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = FtpuserData::REPR_IMAGE;
                }
@@ -2108,7 +2109,7 @@ yyreduce:
   case 56:
 
 /* Line 1455 of yacc.c  */
-#line 338 "ftp_parser.ypp"
+#line 340 "ftp_parser.ypp"
     {
       (yyval.m_nInt) = -1;
                }
@@ -2117,7 +2118,7 @@ yyreduce:
   case 57:
 
 /* Line 1455 of yacc.c  */
-#line 342 "ftp_parser.ypp"
+#line 344 "ftp_parser.ypp"
     {
       (yyval.m_nInt) = -1;
                }
@@ -2126,7 +2127,7 @@ yyreduce:
   case 58:
 
 /* Line 1455 of yacc.c  */
-#line 348 "ftp_parser.ypp"
+#line 350 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = FtpuserData::NON_PRINT;
                }
@@ -2135,7 +2136,7 @@ yyreduce:
   case 59:
 
 /* Line 1455 of yacc.c  */
-#line 352 "ftp_parser.ypp"
+#line 354 "ftp_parser.ypp"
     {
                  (yyval.m_nInt) = -1;
                }
@@ -2144,7 +2145,7 @@ yyreduce:
   case 60:
 
 /* Line 1455 of yacc.c  */
-#line 356 "ftp_parser.ypp"
+#line 358 "ftp_parser.ypp"
     {
       (yyval.m_nInt) = -1;
                }
@@ -2153,7 +2154,7 @@ yyreduce:
 
 
 /* Line 1455 of yacc.c  */
-#line 2157 "ftp_parser.cpp"
+#line 2158 "ftp_parser.cpp"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2372,91 +2373,97 @@ yyreturn:
 
 
 /* Line 1675 of yacc.c  */
-#line 360 "ftp_parser.ypp"
+#line 362 "ftp_parser.ypp"
 
 
 int Ftp::parseControlConnection()
 {
-       if ( td.buffer == NULL || td.buffer->getBuffer() == NULL )
-               return ClientsThread::DELETE_CONNECTION;
-       FtpuserData *pFtpuserData = static_cast<FtpuserData 
*>(td.pConnection->protocolBuffer);
-       if ( pFtpuserData == NULL )
-               return ClientsThread::DELETE_CONNECTION;
-
-       // awaiting commands reply
-       if ( pFtpuserData->m_nFtpstate <= FtpuserData::NO_CONTROL_CONNECTION )
-       {
-               ftpReply(220);
-               pFtpuserData->m_nFtpstate = FtpuserData::CONTROL_CONNECTION_UP;
-       }
+  if (td.buffer == NULL || td.buffer->getBuffer() == NULL)
+    return ClientsThread::DELETE_CONNECTION;
 
-       MemBuf out;
-       escapeTelnet(*td.buffer, out);
-       if ( !m_bEnablePipelining )
-       {
-               MemBuf tmpBuff(out);
-               removePipelinedCmds(tmpBuff, out);
-       }
-       char *pBuffToParse = out.getBuffer();
+  FtpuserData *pFtpuserData = static_cast<FtpuserData *> 
(td.pConnection->protocolBuffer);
+  if (pFtpuserData == NULL)
+    return ClientsThread::DELETE_CONNECTION;
 
-       if ( pBuffToParse == NULL || td.buffersize <= td.m_nParseLength )// 
nothing to parse ...
-               return ClientsThread::KEEP_CONNECTION;
-       else
-               pBuffToParse += td.m_nParseLength;
-
-       yylex_init(&m_scanner);
-       yy_buffer_state *bufstate = yy_scan_string (pBuffToParse, m_scanner);
-       int nParserRet = yyparse(this);
-       yy_delete_buffer(bufstate, m_scanner);
-       yylex_destroy(m_scanner);
-       switch ( nParserRet )
-       {
-               case 0:
-                       if ( pFtpuserData->m_nFtpstate == 
FtpuserData::NO_CONTROL_CONNECTION )
-                               return ClientsThread::DELETE_CONNECTION;
-                       else
-                               return ClientsThread::KEEP_CONNECTION;
-               case 1:
-                       // parsing failed because of invalid input!
-                       return ClientsThread::DELETE_CONNECTION;
-               case 2:
-                       // memory exhaustion!
-                       return ClientsThread::DELETE_CONNECTION;
-       }//TODO: handle INCOMPLETE_REQUEST
-       return ClientsThread::DELETE_CONNECTION;
+  /* awaiting commands reply.  */
+  if (pFtpuserData->m_nFtpstate <= FtpuserData::NO_CONTROL_CONNECTION)
+    {
+      ftpReply (220);
+      pFtpuserData->m_nFtpstate = FtpuserData::CONTROL_CONNECTION_UP;
+    }
+
+  MemBuf out;
+  escapeTelnet (*td.buffer, out);
+  if (! m_bEnablePipelining)
+    {
+      MemBuf tmpBuff (out);
+      removePipelinedCmds (tmpBuff, out);
+    }
+  char *pBuffToParse = out.getBuffer ();
+
+  if (pBuffToParse == NULL || td.buffersize <= td.m_nParseLength )
+    return ClientsThread::KEEP_CONNECTION;
+  else
+    pBuffToParse += td.m_nParseLength;
+
+  yylex_init (&m_scanner);
+  yy_buffer_state *bufstate = yy_scan_string (pBuffToParse, m_scanner);
+  int nParserRet = yyparse (this);
+  yy_delete_buffer (bufstate, m_scanner);
+  yylex_destroy (m_scanner);
+
+  switch (nParserRet)
+    {
+    case 0:
+      if (pFtpuserData->m_nFtpstate == FtpuserData::NO_CONTROL_CONNECTION )
+        return ClientsThread::DELETE_CONNECTION;
+      else
+        return ClientsThread::KEEP_CONNECTION;
+
+    case 1:
+      /* Invalid input.  */
+      return ClientsThread::DELETE_CONNECTION;
+
+    case 2:
+      /* memory exhaustion!  */
+      return ClientsThread::DELETE_CONNECTION;
+    }
+  /*TODO: handle INCOMPLETE_REQUEST */
+  return ClientsThread::DELETE_CONNECTION;
 }
 
-u_long Ftp::computeParseLength(const YYLTYPE &location)
+u_long Ftp::computeParseLength (const YYLTYPE &location)
 {
-       if ( td.buffer == NULL )
-               return 1;
-       int nBuffLine = 1, nBuffCol = 0;
-       char *pszBuff = td.buffer->getBuffer();
-       for ( u_long i = 0; i < td.buffersize; i++ )
-       {
-               if ( pszBuff[i] == '\n' )
-               {
-                       nBuffLine++;
-                       nBuffCol = 0;
-               }
-               else
-                       nBuffCol++;
-               if ( nBuffLine == location.last_line && nBuffCol == 
location.last_column )
-               {
-                       td.m_nParseLength = i;
-                       return 0;
-               }
-       }
-       return 1;//error
+  if (td.buffer == NULL)
+    return 1;
+
+  int nBuffLine = 1, nBuffCol = 0;
+  char *pszBuff = td.buffer->getBuffer ();
+  for (u_long i = 0; i < td.buffersize; i++)
+    {
+      if (pszBuff[i] == '\n')
+        {
+          nBuffLine++;
+          nBuffCol = 0;
+        }
+      else
+        nBuffCol++;
+      if (nBuffLine == location.last_line && nBuffCol == location.last_column)
+        {
+          td.m_nParseLength = i;
+          return 0;
+        }
+    }
+
+  return 1;
 }
 
-///////////////////////////////////////////////////////////
-// global fncs
+/* Global functions.  */
 
-void yyerror(YYLTYPE *pLoc, Ftp *pContext, const char *msg)
+void yyerror (YYLTYPE *pLoc, Ftp *pContext, const char *msg)
 {
-       if ( pContext == NULL )
-               return;
-       pContext->printError(msg);
+  if (pContext == NULL)
+    return;
+  pContext->printError (msg);
 }
 
diff --git a/myserver/src/protocol/ftp/ftp_parser.ypp 
b/myserver/src/protocol/ftp/ftp_parser.ypp
index 618dd09..afd0a21 100755
--- a/myserver/src/protocol/ftp/ftp_parser.ypp
+++ b/myserver/src/protocol/ftp/ftp_parser.ypp
@@ -21,6 +21,7 @@
 }
 
 %{
+#define YYSTACK_ALLOC gnulib::malloc
 #define yyscanner pContext->getScanner()
 %}
 
diff --git a/myserver/src/server/clients_thread.cpp 
b/myserver/src/server/clients_thread.cpp
index bc78372..903dfe6 100644
--- a/myserver/src/server/clients_thread.cpp
+++ b/myserver/src/server/clients_thread.cpp
@@ -102,11 +102,11 @@ DEFINE_THREAD (clients_thread, pParam)
 #ifndef WIN32
   /* Block SigTerm, SigInt, and SigPipe in threads.  */
   sigset_t sigmask;
-  sigemptyset (&sigmask);
-  sigaddset (&sigmask, SIGPIPE);
-  sigaddset (&sigmask, SIGINT);
-  sigaddset (&sigmask, SIGTERM);
-  sigprocmask (SIG_SETMASK, &sigmask, NULL);
+  gnulib::sigemptyset (&sigmask);
+  gnulib::sigaddset (&sigmask, SIGPIPE);
+  gnulib::sigaddset (&sigmask, SIGINT);
+  gnulib::sigaddset (&sigmask, SIGTERM);
+  gnulib::sigprocmask (SIG_SETMASK, &sigmask, NULL);
 #endif
   ClientsThread *ct = (ClientsThread*)pParam;
 

-----------------------------------------------------------------------

Summary of changes:
 myserver/bootstrap.conf                            |    2 +
 myserver/configure.ac                              |    2 +
 myserver/include/base/string/stringutils.h         |    3 -
 myserver/include/base/unix_socket/unix_socket.h    |   15 +-
 myserver/include/protocol/ftp/ftp_lexer.h          |  102 ++++----
 myserver/include/protocol/ftp/ftp_parser.h         |  106 ++++----
 myserver/lib/Makefile.am                           |    1 -
 myserver/src/base/base64/mime_utils.cpp            |    9 +-
 myserver/src/base/crypt/crypt_algo_manager.cpp     |    2 +-
 myserver/src/base/file/file.cpp                    |   18 +-
 myserver/src/base/file/files_utility.cpp           |   16 +-
 myserver/src/base/mem_buff/mem_buff.cpp            |   16 +-
 myserver/src/base/pipe/pipe.cpp                    |   16 +-
 myserver/src/base/process/fork_server.cpp          |    6 +-
 myserver/src/base/process/process.cpp              |   21 +-
 .../src/base/read_directory/read_directory.cpp     |    6 +-
 myserver/src/base/safetime/safetime.cpp            |    4 +-
 myserver/src/base/socket/socket.cpp                |   36 ++--
 myserver/src/base/socket/ssl_socket.cpp            |    4 +-
 myserver/src/base/ssl/ssl.cpp                      |    4 +
 myserver/src/base/string/stringutils.cpp           |    2 +-
 myserver/src/base/sync/event.cpp                   |    2 +-
 myserver/src/base/unix_socket/unix_socket.cpp      |   14 +-
 myserver/src/base/utility.cpp                      |    6 +-
 myserver/src/myserver.cpp                          |   19 +-
 myserver/src/protocol/control/control_protocol.cpp |    8 +-
 myserver/src/protocol/ftp/ftp.cpp                  |    2 +-
 myserver/src/protocol/ftp/ftp_lexer.cpp            |   16 +
 myserver/src/protocol/ftp/ftp_parser.cpp           |  299 ++++++++++----------
 myserver/src/protocol/ftp/ftp_parser.ypp           |    1 +
 myserver/src/server/clients_thread.cpp             |   10 +-
 31 files changed, 398 insertions(+), 370 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]