summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-07-01 09:12:41 +0000
committerAndrew Tridgell <tridge@samba.org>2002-07-01 09:12:41 +0000
commit9930b0b0650ae3e38c033c28672398425dd8228c (patch)
tree47b143202d38ba49bae8be103d6420f5de8f33a3 /source3/lib
parent859b13577309912fc5b3591971412b2cb3a42f28 (diff)
downloadsamba-9930b0b0650ae3e38c033c28672398425dd8228c.tar.gz
samba-9930b0b0650ae3e38c033c28672398425dd8228c.tar.bz2
samba-9930b0b0650ae3e38c033c28672398425dd8228c.zip
used findstatic.pl to make some variables static and remove some dead
code (This used to be commit 91ad9041e9507d36eb3f40c23c5d4df61f139ef0)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/genrand.c4
-rw-r--r--source3/lib/interface.c27
-rw-r--r--source3/lib/md5.c4
-rw-r--r--source3/lib/talloc.c2
-rw-r--r--source3/lib/time.c5
-rw-r--r--source3/lib/util_sid.c28
-rw-r--r--source3/lib/util_sock.c105
7 files changed, 29 insertions, 146 deletions
diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c
index 6296ead726..ee8bc0b1d5 100644
--- a/source3/lib/genrand.c
+++ b/source3/lib/genrand.c
@@ -24,8 +24,8 @@
static unsigned char hash[258];
static uint32 counter;
-unsigned char *reseed_data;
-size_t reseed_data_size;
+static unsigned char *reseed_data;
+static size_t reseed_data_size;
/****************************************************************
Copy any user given reseed data.
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 2704397fb2..0d751a9c7c 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -318,38 +318,11 @@ struct in_addr *iface_n_bcast(int n)
}
-/****************************************************************************
-this function provides a simple hash of the configured interfaces. It is
-used to detect a change in interfaces to tell us whether to discard
-the current wins.dat file.
-Note that the result is independent of the order of the interfaces
- **************************************************************************/
-unsigned iface_hash(void)
-{
- unsigned ret = 0;
- struct interface *i;
-
- for (i=local_interfaces;i;i=i->next) {
- unsigned x1 = (unsigned)str_checksum(inet_ntoa(i->ip));
- unsigned x2 = (unsigned)str_checksum(inet_ntoa(i->nmask));
- ret ^= (x1 ^ x2);
- }
-
- return ret;
-}
-
-
/* these 3 functions return the ip/bcast/nmask for the interface
most appropriate for the given ip address. If they can't find
an appropriate interface they return the requested field of the
first known interface. */
-struct in_addr *iface_bcast(struct in_addr ip)
-{
- struct interface *i = iface_find(ip, True);
- return(i ? &i->bcast : &local_interfaces->bcast);
-}
-
struct in_addr *iface_ip(struct in_addr ip)
{
struct interface *i = iface_find(ip, True);
diff --git a/source3/lib/md5.c b/source3/lib/md5.c
index 627725bb25..0d8f8e74d9 100644
--- a/source3/lib/md5.c
+++ b/source3/lib/md5.c
@@ -22,6 +22,8 @@
#include "md5.h"
+void MD5Transform(uint32 buf[4], uint32 const in[16]);
+
/*
* Note: this code is harmless on little-endian machines.
*/
@@ -161,7 +163,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
-void MD5Transform(uint32 buf[4], uint32 const in[16])
+static void MD5Transform(uint32 buf[4], uint32 const in[16])
{
register uint32 a, b, c, d;
diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c
index d81528588c..0f293e1725 100644
--- a/source3/lib/talloc.c
+++ b/source3/lib/talloc.c
@@ -82,7 +82,7 @@ struct talloc_ctx {
* @todo We should turn the global list off when using Insure++,
* otherwise all the memory will be seen as still reachable.
**/
-TALLOC_CTX *list_head = NULL;
+static TALLOC_CTX *list_head = NULL;
/**
diff --git a/source3/lib/time.c b/source3/lib/time.c
index 9df4763b4c..9d87414aea 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -44,11 +44,6 @@ int extra_time_offset = 0;
External access to time_t_min and time_t_max.
********************************************************************/
-time_t get_time_t_min(void)
-{
- return TIME_T_MIN;
-}
-
time_t get_time_t_max(void)
{
return TIME_T_MAX;
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index b27040b658..7d3bd848ef 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -34,16 +34,16 @@ DOM_SID global_sid_Builtin; /* Local well-known domain */
DOM_SID global_sid_World_Domain; /* Everyone domain */
DOM_SID global_sid_World; /* Everyone */
DOM_SID global_sid_Creator_Owner_Domain; /* Creator Owner domain */
-DOM_SID global_sid_Creator_Owner; /* Creator Owner */
-DOM_SID global_sid_Creator_Group; /* Creator Group */
DOM_SID global_sid_NT_Authority; /* NT Authority */
DOM_SID global_sid_NULL; /* NULL sid */
DOM_SID global_sid_Builtin_Guests; /* Builtin guest users */
DOM_SID global_sid_Authenticated_Users; /* All authenticated rids */
DOM_SID global_sid_Network; /* Network rids */
-DOM_SID global_sid_Anonymous; /* Anonymous login */
-const DOM_SID *global_sid_everyone = &global_sid_World;
+static DOM_SID global_sid_Creator_Owner; /* Creator Owner */
+static DOM_SID global_sid_Creator_Group; /* Creator Group */
+static DOM_SID global_sid_Anonymous; /* Anonymous login */
+static const DOM_SID *global_sid_everyone = &global_sid_World;
/*
* An NT compatible anonymous token.
@@ -302,24 +302,6 @@ void sid_copy(DOM_SID *dst, const DOM_SID *src)
dst->sub_auths[i] = src->sub_auths[i];
}
-/*****************************************************************
- Duplicates a sid - mallocs the target.
-*****************************************************************/
-
-DOM_SID *sid_dup(DOM_SID *src)
-{
- DOM_SID *dst;
-
- if(!src)
- return NULL;
-
- if((dst = malloc(sizeof(DOM_SID))) != NULL) {
- memset(dst, '\0', sizeof(DOM_SID));
- sid_copy( dst, src);
- }
-
- return dst;
-}
/*****************************************************************
Write a sid out into on-the-wire format.
@@ -361,7 +343,7 @@ BOOL sid_parse(char *inbuf, size_t len, DOM_SID *sid)
/*****************************************************************
Compare the auth portion of two sids.
*****************************************************************/
-int sid_compare_auth(const DOM_SID *sid1, const DOM_SID *sid2)
+static int sid_compare_auth(const DOM_SID *sid1, const DOM_SID *sid2)
{
int i;
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index f72c4638dc..b16d34e1f4 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -50,7 +50,7 @@ typedef struct smb_socket_option {
int opttype;
} smb_socket_option;
-smb_socket_option socket_options[] = {
+static const smb_socket_option socket_options[] = {
{"SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE, 0, OPT_BOOL},
{"SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR, 0, OPT_BOOL},
{"SO_BROADCAST", SOL_SOCKET, SO_BROADCAST, 0, OPT_BOOL},
@@ -189,7 +189,7 @@ ssize_t read_udp_socket(int fd,char *buf,size_t len)
/*******************************************************************
checks if read data is outstanding.
********************************************************************/
-int read_data_outstanding(int fd, unsigned int time_out)
+static int read_data_outstanding(int fd, unsigned int time_out)
{
int selrtn;
fd_set fds;
@@ -365,20 +365,6 @@ ssize_t read_with_timeout(int fd, char *buf, size_t mincnt, size_t maxcnt,
}
/****************************************************************************
-send a keepalive packet (rfc1002)
-****************************************************************************/
-
-BOOL send_keepalive(int client)
-{
- unsigned char buf[4];
-
- buf[0] = SMBkeepalive;
- buf[1] = buf[2] = buf[3] = 0;
-
- return(write_socket_data(client,(char *)buf,4) == 4);
-}
-
-/****************************************************************************
read data from the client, reading exactly N bytes.
****************************************************************************/
@@ -466,7 +452,7 @@ ssize_t write_data(int fd,char *buffer,size_t N)
Write data to a socket - use send rather than write.
****************************************************************************/
-ssize_t write_socket_data(int fd,char *buffer,size_t N)
+static ssize_t write_socket_data(int fd,char *buffer,size_t N)
{
size_t total=0;
ssize_t ret;
@@ -506,6 +492,21 @@ ssize_t write_socket(int fd,char *buf,size_t len)
}
/****************************************************************************
+send a keepalive packet (rfc1002)
+****************************************************************************/
+
+BOOL send_keepalive(int client)
+{
+ unsigned char buf[4];
+
+ buf[0] = SMBkeepalive;
+ buf[1] = buf[2] = buf[3] = 0;
+
+ return(write_socket_data(client,(char *)buf,4) == 4);
+}
+
+
+/****************************************************************************
read 4 bytes of a smb packet and return the smb length of the packet
store the result in the buffer
This version of the function will return a length of zero on receiving
@@ -656,45 +657,6 @@ BOOL send_smb(int fd,char *buffer)
}
/****************************************************************************
-send a single packet to a port on another machine
-****************************************************************************/
-
-BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type)
-{
- BOOL ret;
- int out_fd;
- struct sockaddr_in sock_out;
-
- /* create a socket to write to */
- out_fd = socket(AF_INET, type, 0);
- if (out_fd == -1)
- {
- DEBUG(0,("socket failed"));
- return False;
- }
-
- /* set the address and port */
- memset((char *)&sock_out,'\0',sizeof(sock_out));
- putip((char *)&sock_out.sin_addr,(char *)&ip);
- sock_out.sin_port = htons( port );
- sock_out.sin_family = AF_INET;
-
- if (DEBUGLEVEL > 0)
- DEBUG(3,("sending a packet of len %d to (%s) on port %d of type %s\n",
- len,inet_ntoa(ip),port,type==SOCK_DGRAM?"DGRAM":"STREAM"));
-
- /* send it */
- ret = (sys_sendto(out_fd,buf,len,0,(struct sockaddr *)&sock_out,sizeof(sock_out)) >= 0);
-
- if (!ret)
- DEBUG(0,("Packet send to %s(%d) failed ERRNO=%s\n",
- inet_ntoa(ip),port,strerror(errno)));
-
- close(out_fd);
- return(ret);
-}
-
-/****************************************************************************
Open a socket of the specified type, port, and address for incoming data.
****************************************************************************/
@@ -1002,37 +964,6 @@ char *get_socket_addr(int fd)
return addr_buf;
}
-/*******************************************************************
- opens and connects to a unix pipe socket
- ******************************************************************/
-int open_pipe_sock(char *path)
-{
- int sock;
- struct sockaddr_un sa;
-
- sock = socket(AF_UNIX, SOCK_STREAM, 0);
-
- if (sock < 0)
- {
- DEBUG(0, ("unix socket open failed\n"));
- return sock;
- }
-
- ZERO_STRUCT(sa);
- sa.sun_family = AF_UNIX;
- safe_strcpy(sa.sun_path, path, sizeof(sa.sun_path)-1);
-
- DEBUG(10, ("socket open succeeded. file name: %s\n", sa.sun_path));
-
- if (connect(sock, (struct sockaddr*) &sa, sizeof(sa)) < 0)
- {
- DEBUG(0,("socket connect to %s failed\n", sa.sun_path));
- close(sock);
- return -1;
- }
-
- return sock;
-}
/*******************************************************************
Create protected unix domain socket.