Rename ASN1_BITFIELD to ASN1_BIT_STRING.
[ira/wip.git] / source3 / libsmb / nmblib.c
index bfe5e7b97bda22a89303e15c1be05e5e75b41b80..5f3eda44fe2960300e2e2e79fc42016b550c3c57 100644 (file)
@@ -21,9 +21,6 @@
 
 #include "includes.h"
 
-int num_good_sends = 0;
-int num_good_receives = 0;
-
 static const struct opcode_names {
        const char *nmb_opcode_name;
        int opcode;
@@ -796,8 +793,6 @@ struct packet_struct *read_packet(int fd,enum packet_type packet_type)
 
        packet->fd = fd;
 
-       num_good_receives++;
-
        DEBUG(5,("Received a packet of len %d from (%s) port %d\n",
                 length, inet_ntoa(packet->ip), packet->port ) );
 
@@ -838,9 +833,6 @@ static bool send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
                DEBUG(0,("Packet send failed to %s(%d) ERRNO=%s\n",
                        inet_ntoa(ip),port,strerror(errno)));
 
-       if (ret)
-               num_good_sends++;
-
        return(ret);
 }
 
@@ -1287,12 +1279,19 @@ static int name_interpret(char *in, fstring name)
  Note:  <Out> must be (33 + strlen(scope) + 2) bytes long, at minimum.
 ****************************************************************************/
 
-int name_mangle( char *In, char *Out, char name_type )
+char *name_mangle(TALLOC_CTX *mem_ctx, char *In, char name_type)
 {
        int   i;
        int   len;
        nstring buf;
-       char *p = Out;
+       char *result;
+       char *p;
+
+       result = talloc_array(mem_ctx, char, 33 + strlen(global_scope()) + 2);
+       if (result == NULL) {
+               return NULL;
+       }
+       p = result;
 
        /* Safely copy the input string, In, into buf[]. */
        if (strcmp(In,"*") == 0)
@@ -1329,7 +1328,7 @@ int name_mangle( char *In, char *Out, char name_type )
                                p[0] = len;
                                if( len > 0 )
                                        p[len+1] = 0;
-                               return( name_len(Out) );
+                               return result;
                        case '.':
                                p[0] = len;
                                p   += (len + 1);
@@ -1341,7 +1340,7 @@ int name_mangle( char *In, char *Out, char name_type )
                }
        }
 
-       return( name_len(Out) );
+       return result;
 }
 
 /****************************************************************************