include/smb.h: Re-added zero pointer protection to ZERO_STRUCTP.
authorJeremy Allison <jra@samba.org>
Fri, 13 Nov 1998 02:07:07 +0000 (02:07 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 13 Nov 1998 02:07:07 +0000 (02:07 +0000)
lib/util_sock.c: Added strerror() calls to getpeername failures (which seem to be giving IRIX trouble at the moment).
rpc_parse/parse_sec.c: Changed use of ZERO_STRUCTPN to ZERO_STRUCTP which again does zero pointer protection.
smbd/quotas.c: Fixed typo.
Jeremy.
(This used to be commit b62f008974c96e0302d6c146cf49bc2045bef005)

source3/include/smb.h
source3/lib/util_sock.c
source3/rpc_parse/parse_sec.c
source3/smbd/quotas.c

index 9339cdda6f06e5c3e622613cfce6e776b039e685..bb055214ec540b246026e6018d1533ab8fb86d02 100644 (file)
@@ -1655,9 +1655,7 @@ extern int unix_ERR_code;
 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
 
 /* zero a structure given a pointer to the structure */
-#define ZERO_STRUCTP(x) { memset((char *)(x), 0, sizeof(*(x))); }
-
-#define ZERO_STRUCTPN(x) { if (x != NULL) ZERO_STRUCTP(x); }
+#define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); }
 
 /* zero an array - note that sizeof(array) must work - ie. it must not be a 
    pointer */
index 47c94f21fc4accffbd2c3e7fbc8ab705b365d6bc..3a52732a2ac97b027557a2d04559336dfdd8b21a 100644 (file)
@@ -795,7 +795,7 @@ char *client_name(int fd)
        }
        
        if (getpeername(fd, &sa, &length) < 0) {
-               DEBUG(0,("getpeername failed\n"));
+               DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) ));
                return name_buf;
        }
        
@@ -840,7 +840,7 @@ char *client_addr(int fd)
        }
        
        if (getpeername(fd, &sa, &length) < 0) {
-               DEBUG(0,("getpeername failed\n"));
+               DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) ));
                return addr_buf;
        }
        
index 0b0c08fe136bc64f967a86626cacab5a6b2bcc83..c802f9c2d1f17514f52d2f148335938e0c0737b9 100644 (file)
@@ -149,7 +149,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth)
        {
                /* reading */
                t->ace = malloc(sizeof(t->ace[0]) * t->num_aces);
-               ZERO_STRUCTPN(t->ace);
+               ZERO_STRUCTP(t->ace);
        }
 
        if (t->ace == NULL && t->num_aces != 0)
@@ -316,7 +316,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
                {
                        /* reading */
                        t->dacl = malloc(sizeof(*t->dacl));
-                       ZERO_STRUCTPN(t->dacl);
+                       ZERO_STRUCTP(t->dacl);
                }
 
                if (t->dacl == NULL)
@@ -348,7 +348,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
                {
                        /* reading */
                        t->sacl = malloc(sizeof(*t->sacl));
-                       ZERO_STRUCTPN(t->sacl);
+                       ZERO_STRUCTP(t->sacl);
                }
 
                if (t->sacl == NULL)
@@ -383,7 +383,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
                {
                        /* reading */
                        t->owner_sid = malloc(sizeof(*t->owner_sid));
-                       ZERO_STRUCTPN(t->owner_sid);
+                       ZERO_STRUCTP(t->owner_sid);
                }
 
                if (t->owner_sid == NULL)
@@ -412,7 +412,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
                {
                        /* reading */
                        t->grp_sid = malloc(sizeof(*t->grp_sid));
-                       ZERO_STRUCTPN(t->grp_sid);
+                       ZERO_STRUCTP(t->grp_sid);
                }
 
                if (t->grp_sid == NULL)
@@ -485,7 +485,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth)
        {
                /* reading */
                sec->sec = malloc(sizeof(*sec->sec));
-               ZERO_STRUCTPN(sec->sec);
+               ZERO_STRUCTP(sec->sec);
 
                if (sec->sec == NULL)
                {
index 6df668e279b86f21a547749f184eeb67f7e17711..5cd5a895c6b06bbe5d005cd7d4a81ece2bff7dbd 100644 (file)
@@ -373,7 +373,7 @@ BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_U
 #include <ufs/quota.h>
 
 /****************************************************************************
-try to get the disk space from disk quotas - OFS1 version
+try to get the disk space from disk quotas - OSF1 version
 ****************************************************************************/
 
 BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)