summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/bitmap.c11
-rw-r--r--source3/lib/interface.c17
-rw-r--r--source3/lib/membuffer.c15
-rw-r--r--source3/lib/util.c198
-rw-r--r--source3/lib/util_hnd.c22
5 files changed, 33 insertions, 230 deletions
diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c
index ce677f7846..9ccdbb420b 100644
--- a/source3/lib/bitmap.c
+++ b/source3/lib/bitmap.c
@@ -51,17 +51,6 @@ struct bitmap *bitmap_allocate(int n)
}
/****************************************************************************
-free a bitmap structure
-****************************************************************************/
-void bitmap_free(struct bitmap *bm)
-{
- free(bm->b);
- bm->b = NULL;
- free(bm);
-}
-
-
-/****************************************************************************
set a bit in a bitmap
****************************************************************************/
BOOL bitmap_set(struct bitmap *bm, unsigned i)
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 581a2135bd..65d276021c 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -260,17 +260,6 @@ BOOL ismyip(struct in_addr ip)
}
/****************************************************************************
- check if a bcast is one of mine
- **************************************************************************/
-BOOL ismybcast(struct in_addr bcast)
-{
- struct interface *i;
- for (i=local_interfaces;i;i=i->next)
- if (ip_equal(i->bcast,bcast)) return True;
- return False;
-}
-
-/****************************************************************************
check if a packet is from a local (known) net
**************************************************************************/
BOOL is_local_net(struct in_addr from)
@@ -383,12 +372,6 @@ struct in_addr *iface_bcast(struct in_addr ip)
return(i ? &i->bcast : &local_interfaces->bcast);
}
-struct in_addr *iface_nmask(struct in_addr ip)
-{
- struct interface *i = iface_find(ip);
- return(i ? &i->nmask : &local_interfaces->nmask);
-}
-
struct in_addr *iface_ip(struct in_addr ip)
{
struct interface *i = iface_find(ip);
diff --git a/source3/lib/membuffer.c b/source3/lib/membuffer.c
index 90b07047d3..85f63e8c06 100644
--- a/source3/lib/membuffer.c
+++ b/source3/lib/membuffer.c
@@ -95,17 +95,6 @@ void mem_create(struct mem_buf *buf, char *data, int size, int margin, BOOL dyna
}
/*******************************************************************
- takes a memory buffer out of one structure: puts it in the other.
- NULLs the one that the buffer is being stolen from.
- ********************************************************************/
-void mem_take(struct mem_buf *mem_to, struct mem_buf *mem_from)
-{
- memcpy(mem_to, mem_from, sizeof(*mem_to));
-
- mem_init(mem_from, mem_from->margin);
-}
-
-/*******************************************************************
allocate a memory buffer. assume it's empty
********************************************************************/
BOOL mem_alloc_data(struct mem_buf *buf, int size)
@@ -218,7 +207,7 @@ void mem_buf_free(struct mem_buf **buf)
/*******************************************************************
frees a memory buffer chain. assumes that all items are malloced.
********************************************************************/
-void mem_free_chain(struct mem_buf **buf)
+static void mem_free_chain(struct mem_buf **buf)
{
if (buf == NULL) return;
if ((*buf) == NULL) return;
@@ -312,7 +301,7 @@ BOOL mem_grow_data(struct mem_buf **buf, BOOL io, int new_size, BOOL force_grow)
/*******************************************************************
search for a memory buffer that falls within the specified offset
********************************************************************/
-BOOL mem_find(struct mem_buf **buf, uint32 offset)
+static BOOL mem_find(struct mem_buf **buf, uint32 offset)
{
struct mem_buf *f;
if (buf == NULL) return False;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 8432071d80..ad84b17943 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -206,25 +206,10 @@ char **toktocliplist(int *ctok, char *sep)
return ret;
}
-
-/* ************************************************************************* **
- * Duplicate a block of memory.
- * ************************************************************************* **
- */
-void *mem_dup( void *from, int size )
- {
- void *tmp;
-
- tmp = malloc( size );
- if( NULL != tmp )
- (void)memcpy( tmp, from, size );
- return( tmp );
- } /* mem_dup */
-
/****************************************************************************
prompte a dptr (to make it recently used)
****************************************************************************/
-void array_promote(char *array,int elsize,int element)
+static void array_promote(char *array,int elsize,int element)
{
char *p;
if (element == 0)
@@ -1050,7 +1035,7 @@ int set_message(char *buf,int num_words,int num_bytes,BOOL zero)
/*******************************************************************
return the number of smb words
********************************************************************/
-int smb_numwords(char *buf)
+static int smb_numwords(char *buf)
{
return (CVAL(buf,smb_wct));
}
@@ -1066,7 +1051,7 @@ int smb_buflen(char *buf)
/*******************************************************************
return a pointer to the smb_buf data area
********************************************************************/
-int smb_buf_ofs(char *buf)
+static int smb_buf_ofs(char *buf)
{
return (smb_size + CVAL(buf,smb_wct)*2);
}
@@ -1476,6 +1461,26 @@ static void expand_one(char *Mask,int len)
}
/****************************************************************************
+parse out a directory name from a path name. Assumes dos style filenames.
+****************************************************************************/
+static char *dirname_dos(char *path,char *buf)
+{
+ char *p = strrchr(path,'\\');
+
+ if (!p)
+ pstrcpy(buf,path);
+ else
+ {
+ *p = 0;
+ pstrcpy(buf,path);
+ *p = '\\';
+ }
+
+ return(buf);
+}
+
+
+/****************************************************************************
expand a wildcard expression, replacing *s with ?s
****************************************************************************/
void expand_mask(char *Mask,BOOL doext)
@@ -1755,7 +1760,7 @@ else
if SYSV use O_NDELAY
if BSD use FNDELAY
****************************************************************************/
-int set_blocking(int fd, BOOL set)
+static int set_blocking(int fd, BOOL set)
{
int val;
#ifdef O_NONBLOCK
@@ -1932,33 +1937,6 @@ int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out)
return(nread);
}
-/****************************************************************************
-read data from the client. Maxtime is in milliseconds
-****************************************************************************/
-int read_max_udp(int fd,char *buffer,int bufsize,int maxtime)
-{
- fd_set fds;
- int selrtn;
- int nread;
- struct timeval timeout;
-
- FD_ZERO(&fds);
- FD_SET(fd,&fds);
-
- timeout.tv_sec = maxtime / 1000;
- timeout.tv_usec = (maxtime % 1000) * 1000;
-
- selrtn = sys_select(fd+1,&fds,maxtime>0?&timeout:NULL);
-
- if (!FD_ISSET(fd,&fds))
- return 0;
-
- nread = read_udp_socket(fd, buffer, bufsize);
-
- /* return the number got */
- return(nread);
-}
-
/*******************************************************************
find the difference in milliseconds between two struct timeval
values
@@ -2064,7 +2042,7 @@ SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen,
#ifdef LARGE_SMB_OFF_T
DEBUG(4,("transfer_file n=%.0f (head=%d) called\n",(double)n,headlen));
#else /* LARGE_SMB_OFF_T */
- DEBUG(4,("transfer_file n=%d (head=%d) called\n",n,headlen));
+ DEBUG(4,("transfer_file n=%d (head=%d) called\n",(int)n,headlen));
#endif /* LARGE_SMB_OFF_T */
if (size == 0) {
@@ -2501,7 +2479,7 @@ BOOL send_smb(int fd,char *buffer)
/****************************************************************************
find a pointer to a netbios name
****************************************************************************/
-char *name_ptr(char *buf,int ofs)
+static char *name_ptr(char *buf,int ofs)
{
unsigned char c = *(unsigned char *)(buf+ofs);
@@ -2595,7 +2573,7 @@ BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type)
/*******************************************************************
sleep for a specified number of milliseconds
********************************************************************/
-void msleep(int t)
+static void msleep(int t)
{
int tdiff=0;
struct timeval tval,t1,t2;
@@ -3307,20 +3285,6 @@ int set_filelen(int fd, SMB_OFF_T len)
}
-/****************************************************************************
-return the byte checksum of some data
-****************************************************************************/
-int byte_checksum(char *buf,int len)
-{
- unsigned char *p = (unsigned char *)buf;
- int ret = 0;
- while (len--)
- ret += *p++;
- return(ret);
-}
-
-
-
#ifdef HPUX
/****************************************************************************
this is a version of setbuffer() for those machines that only have setvbuf
@@ -3333,26 +3297,6 @@ this is a version of setbuffer() for those machines that only have setvbuf
/****************************************************************************
-parse out a directory name from a path name. Assumes dos style filenames.
-****************************************************************************/
-char *dirname_dos(char *path,char *buf)
-{
- char *p = strrchr(path,'\\');
-
- if (!p)
- pstrcpy(buf,path);
- else
- {
- *p = 0;
- pstrcpy(buf,path);
- *p = '\\';
- }
-
- return(buf);
-}
-
-
-/****************************************************************************
parse out a filename from a path name. Assumes dos style filenames.
****************************************************************************/
static char *filename_dos(char *path,char *buf)
@@ -3953,8 +3897,7 @@ static char *automount_lookup(char *user_name)
This is Luke's original function with the NIS lookup code
moved out to a separate function.
*******************************************************************/
-
-char *automount_server(char *user_name)
+static char *automount_server(char *user_name)
{
static pstring server_name;
@@ -3988,8 +3931,7 @@ char *automount_server(char *user_name)
Patch from jkf@soton.ac.uk
Added this to implement %p (NIS auto-map version of %H)
*******************************************************************/
-
-char *automount_path(char *user_name)
+static char *automount_path(char *user_name)
{
static pstring server_path;
@@ -4609,7 +4551,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
(double)offset,(double)count,op,type,strerror(errno)));
#else
DEBUG(3,("lock failed at offset %d count %d op %d type %d (%s)\n",
- offset,count,op,type,strerror(errno)));
+ (int)offset,(int)count,op,type,strerror(errno)));
#endif
/* perhaps it doesn't support this sort of locking?? */
@@ -4632,40 +4574,6 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
}
/*******************************************************************
-lock a file - returning a open file descriptor or -1 on failure
-The timeout is in seconds. 0 means no timeout
-********************************************************************/
-int file_lock(char *name,int timeout)
-{
- int fd = open(name,O_RDWR|O_CREAT,0666);
- time_t t=0;
- if (fd < 0) return(-1);
-
-#if HAVE_FCNTL_LOCK
- if (timeout) t = time(NULL);
- while (!timeout || (time(NULL)-t < timeout)) {
- if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)) return(fd);
- msleep(LOCK_RETRY_TIMEOUT);
- }
- return(-1);
-#else
- return(fd);
-#endif
-}
-
-/*******************************************************************
-unlock a file locked by file_lock
-********************************************************************/
-void file_unlock(int fd)
-{
- if (fd<0) return;
-#if HAVE_FCNTL_LOCK
- fcntl_lock(fd,SMB_F_SETLK,0,1,F_UNLCK);
-#endif
- close(fd);
-}
-
-/*******************************************************************
is the name specified one of my netbios names
returns true is it is equal, false otherwise
********************************************************************/
@@ -4844,26 +4752,6 @@ char *unistr(char *buf)
return lbuf;
}
-/*******************************************************************
-strncpy for unicode strings
-********************************************************************/
-int unistrncpy(char *dst, char *src, int len)
-{
- int num_wchars = 0;
-
- while (*src && len > 0)
- {
- *dst++ = *src++;
- *dst++ = *src++;
- len--;
- num_wchars++;
- }
- *dst++ = 0;
- *dst++ = 0;
-
- return num_wchars;
-}
-
/*******************************************************************
strcpy for unicode strings. returns length (in num of wide chars)
@@ -4947,18 +4835,6 @@ char *safe_strcat(char *dest, char *src, int maxlength)
}
/*******************************************************************
-align a pointer to a multiple of 4 bytes
-********************************************************************/
-char *align4(char *q, char *base)
-{
- if ((q - base) & 3)
- {
- q += 4 - ((q - base) & 3);
- }
- return q;
-}
-
-/*******************************************************************
align a pointer to a multiple of 2 bytes
********************************************************************/
char *align2(char *q, char *base)
@@ -4970,20 +4846,6 @@ char *align2(char *q, char *base)
return q;
}
-/*******************************************************************
-align a pointer to a multiple of align_offset bytes. looks like it
-will work for offsets of 0, 2 and 4...
-********************************************************************/
-char *align_offset(char *q, char *base, int align_offset_len)
-{
- int mod = ((q - base) & (align_offset_len-1));
- if (align_offset_len != 0 && mod != 0)
- {
- q += align_offset_len - mod;
- }
- return q;
-}
-
void print_asc(int level, unsigned char *buf,int len)
{
int i;
diff --git a/source3/lib/util_hnd.c b/source3/lib/util_hnd.c
index d65116e646..addedaec90 100644
--- a/source3/lib/util_hnd.c
+++ b/source3/lib/util_hnd.c
@@ -64,7 +64,7 @@ static struct bitmap *bmap;
/****************************************************************************
create a unique policy handle
****************************************************************************/
-void create_pol_hnd(POLICY_HND *hnd)
+static void create_pol_hnd(POLICY_HND *hnd)
{
static uint32 pol_hnd_low = 0;
static uint32 pol_hnd_high = 0;
@@ -263,26 +263,6 @@ BOOL set_lsa_policy_reg_name(POLICY_HND *hnd, fstring name)
}
/****************************************************************************
- get reg name
-****************************************************************************/
-BOOL get_lsa_policy_reg_name(POLICY_HND *hnd, char *name)
-{
- struct policy *p = find_lsa_policy(hnd);
-
- if (p && p->open) {
- fstrcpy(name, p->dev.reg.name);
-
- DEBUG(3,("Getting policy pnum=%x name=%s\n",
- p->pnum, name));
-
- return True;
- }
-
- DEBUG(3,("Error getting policy\n"));
- return False;
-}
-
-/****************************************************************************
close an lsa policy
****************************************************************************/
BOOL close_lsa_policy_hnd(POLICY_HND *hnd)