Send Linux-ha-cvs mailing list submissions to
        linux-ha-cvs@lists.linux-ha.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: lib by zhenh from  (linux-ha-cvs@lists.linux-ha.org)
   2. Linux-HA CVS: mgmt by zhenh from 
      (linux-ha-cvs@lists.linux-ha.org)
   3. Linux-HA CVS: mgmt by zhenh from 
      (linux-ha-cvs@lists.linux-ha.org)
   4. Linux-HA CVS: lib by zhenh from  (linux-ha-cvs@lists.linux-ha.org)


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

Message: 1
Date: Wed, 16 Aug 2006 01:46:43 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/mgmt


Modified Files:
        mgmt_client_lib.c 


Log Message:
when the msg is too long, report failure instead of cut it
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/mgmt/mgmt_client_lib.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- mgmt_client_lib.c   30 Mar 2006 07:59:01 -0000      1.3
+++ mgmt_client_lib.c   16 Aug 2006 07:46:43 -0000      1.4
@@ -107,7 +107,7 @@
 mgmt_sendmsg(const char* msg)
 {
        /* send the msg */
-       if (-1 == mgmt_session_sendmsg(session, msg)) {
+       if (mgmt_session_sendmsg(session, msg) < 0) {
                return NULL;
        }
        /* get the result msg */
@@ -159,6 +159,9 @@
        }
        /* send the msg, with the last zero */
        len = strnlen(msg, MAX_MSGLEN)+1;
+       if (len == MAX_MSGLEN + 1) {
+               return -2;
+       }
        if (len != tls_send(session, msg, len)) {
                return -1;
        }




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

Message: 2
Date: Wed, 16 Aug 2006 01:46:43 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: mgmt by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : mgmt

Dir     : linux-ha/mgmt/daemon


Modified Files:
        mgmtd.c 


Log Message:
when the msg is too long, report failure instead of cut it
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/mgmt/daemon/mgmtd.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- mgmtd.c     16 Aug 2006 07:24:40 -0000      1.24
+++ mgmtd.c     16 Aug 2006 07:46:43 -0000      1.25
@@ -72,6 +72,7 @@
 static void shutdown_mgmtd(void);
 static int on_event(const char* event);
 static int usr_belong_grp(const char* usr, const char* grp);
+static int _mgmt_session_sendmsg(void* session, const char* msg);
 
 /* management daemon internal data structure */
 typedef struct
@@ -442,7 +443,7 @@
                if (msg == NULL || num != 3 || STRNCMP_CONST(args[0], 
MSG_LOGIN) != 0) {
                        mgmt_del_args(args);
                        mgmt_del_msg(msg);
-                       mgmt_session_sendmsg(session, MSG_FAIL);
+                       _mgmt_session_sendmsg(session, MSG_FAIL);
                        tls_detach(session);
                        close(csock);
                        mgmt_log(LOG_ERR, "%s receive login msg failed", 
__FUNCTION__);
@@ -453,7 +454,7 @@
                if (pam_auth(args[1],args[2]) != 0 || 
!usr_belong_grp(args[1],ALLOW_GRP)) {
                        mgmt_del_args(args);
                        mgmt_del_msg(msg);
-                       mgmt_session_sendmsg(session, MSG_FAIL);
+                       _mgmt_session_sendmsg(session, MSG_FAIL);
                        tls_detach(session);
                        close(csock);
                        mgmt_log(LOG_ERR, "%s pam auth failed", __FUNCTION__);
@@ -462,7 +463,7 @@
                mgmt_del_args(args);
                mgmt_del_msg(msg);
                mgmt_debug(LOG_DEBUG, "send msg: %s", MSG_OK);
-               mgmt_session_sendmsg(session, MSG_OK);
+               _mgmt_session_sendmsg(session, MSG_OK);
                new_client(csock, session);
                return TRUE;
                
@@ -493,12 +494,12 @@
                ret = dispatch_msg(msg, client->id);
                if (ret != NULL) {
                        mgmt_debug(LOG_DEBUG, "send msg: %s", ret);
-                       mgmt_session_sendmsg(client->session, ret);
+                       _mgmt_session_sendmsg(client->session, ret);
                        mgmt_del_msg(ret);
                }
                else {
                        mgmt_debug(LOG_DEBUG, "send msg: %s", MSG_FAIL);
-                       mgmt_session_sendmsg(client->session, MSG_FAIL);
+                       _mgmt_session_sendmsg(client->session, MSG_FAIL);
                }
                mgmt_del_msg(msg);
        }
@@ -624,7 +625,6 @@
        node = id_list;
        while (node != NULL) {
                client_t* client;
-               
                int id = GPOINTER_TO_INT(node->data);
                
                client = lookup_client(id);
@@ -637,7 +637,7 @@
                }
 
                mgmt_debug(LOG_DEBUG, "send evt: %s", event);
-               mgmt_session_sendmsg(client->session, event);
+               _mgmt_session_sendmsg(client->session, event);
                mgmt_debug(LOG_DEBUG, "send evt: %s done", event);
                
                node = g_list_next(node);
@@ -713,3 +713,15 @@
        }
        return 0;
 }
+int 
+_mgmt_session_sendmsg(void* session, const char* msg)
+{
+       int ret = mgmt_session_sendmsg(session, msg);
+       if(ret == -1) {
+               mgmt_log(LOG_ERR,"send msg %s failed", msg);
+       }
+       else if (ret == -2) {
+               mgmt_log(LOG_ERR,"send msg %s failed(msg too long)", msg);
+       }
+       return ret;
+}




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

Message: 3
Date: Wed, 16 Aug 2006 01:53:12 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: mgmt by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : mgmt

Dir     : linux-ha/mgmt/daemon


Modified Files:
        mgmtd.c 


Log Message:
close the exist socket if the tls initialization failed. found by dvlt
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/mgmt/daemon/mgmtd.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- mgmtd.c     16 Aug 2006 07:46:43 -0000      1.25
+++ mgmtd.c     16 Aug 2006 07:53:12 -0000      1.26
@@ -436,6 +436,7 @@
                session = tls_attach_server(csock);
                if (session == NULL) {
                        mgmt_log(LOG_ERR, "%s attach server socket failed", 
__FUNCTION__);
+                       close(csock);
                        return TRUE;
                }
                msg = mgmt_session_recvmsg(session);




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

Message: 4
Date: Wed, 16 Aug 2006 02:36:52 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/clplumbing


Modified Files:
        cl_pidfile.c 


Log Message:
close some fd, patched by dvlt
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/clplumbing/cl_pidfile.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- cl_pidfile.c        29 Jul 2005 23:16:56 -0000      1.7
+++ cl_pidfile.c        16 Aug 2006 08:36:51 -0000      1.8
@@ -119,6 +119,7 @@
                        }
                }
                unlink(lf_name);
+               close(fd);
        }
        if ((fd = open(tf_name, O_CREAT | O_WRONLY | O_EXCL, 0644)) < 0) {
                /* Hmmh, why did we fail? Anyway, nothing we can do about it */
@@ -202,17 +203,20 @@
        }
        
        if (read(fd, buf, sizeof(buf)) < 1) {
+               close(fd);
                return -1;
        } 
        
        if (sscanf(buf, "%lu", &pid) <= 0) {
+               close(fd);
                return -1;
        }
        
        if (pid <= 0){
+               close(fd);
                return -1;
        }
-
+       close(fd);
        return pid;
 }
 




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

_______________________________________________
Linux-ha-cvs mailing list
Linux-ha-cvs@lists.linux-ha.org
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 33, Issue 68
********************************************

Reply via email to