summaryrefslogtreecommitdiffstats
path: root/source/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/lib/util.c')
-rw-r--r--source/lib/util.c65
1 files changed, 28 insertions, 37 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index d244e390d22..42ead313a92 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -23,11 +23,6 @@
#include "includes.h"
-extern fstring local_machine;
-extern char *global_clobber_region_function;
-extern unsigned int global_clobber_region_line;
-extern fstring remote_arch;
-
/* Max allowable allococation - 256mb - 0x10000000 */
#define MAX_ALLOC_SIZE (1024*1024*256)
@@ -235,6 +230,7 @@ BOOL set_netbios_aliases(const char **str_array)
BOOL init_names(void)
{
+ extern fstring local_machine;
char *p;
int n;
@@ -278,11 +274,28 @@ const char *tmpdir(void)
}
/****************************************************************************
+ Determine whether we are in the specified group.
+****************************************************************************/
+
+BOOL in_group(gid_t group, gid_t current_gid, int ngroups, const gid_t *groups)
+{
+ int i;
+
+ if (group == current_gid)
+ return(True);
+
+ for (i=0;i<ngroups;i++)
+ if (group == groups[i])
+ return(True);
+
+ return(False);
+}
+
+/****************************************************************************
Add a gid to an array of gids if it's not already there.
****************************************************************************/
-void add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
- gid_t **gids, int *num)
+void add_gid_to_array_unique(gid_t gid, gid_t **gids, int *num)
{
int i;
@@ -290,11 +303,8 @@ void add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
if ((*gids)[i] == gid)
return;
}
-
- if (mem_ctx != NULL)
- *gids = TALLOC_REALLOC_ARRAY(mem_ctx, *gids, gid_t, *num+1);
- else
- *gids = SMB_REALLOC_ARRAY(*gids, gid_t, *num+1);
+
+ *gids = SMB_REALLOC_ARRAY(*gids, gid_t, *num+1);
if (*gids == NULL)
return;
@@ -607,7 +617,7 @@ void unix_clean_name(char *s)
Make a dir struct.
****************************************************************************/
-void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T size,int mode,time_t date, BOOL uc)
+void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T size,int mode,time_t date)
{
char *p;
pstring mask2;
@@ -631,9 +641,7 @@ void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T si
put_dos_date(buf,22,date);
SSVAL(buf,26,size & 0xFFFF);
SSVAL(buf,28,(size >> 16)&0xFFFF);
- /* We only uppercase if FLAGS2_LONG_PATH_COMPONENTS is zero in the input buf.
- Strange, but verified on W2K3. Needed for OS/2. JRA. */
- push_ascii(buf+30,fname,12, uc ? STR_UPPER : 0);
+ push_ascii(buf+30,fname,12,0);
DEBUG(8,("put name [%s] from [%s] into dir struct\n",buf+30, fname));
}
@@ -1457,6 +1465,8 @@ void smb_panic2(const char *why, BOOL decrement_pid_count )
#ifdef DEVELOPER
{
+ extern char *global_clobber_region_function;
+ extern unsigned int global_clobber_region_line;
if (global_clobber_region_function) {
DEBUG(0,("smb_panic: clobber_region() last called from [%s(%u)]\n",
@@ -1921,6 +1931,7 @@ void ra_lanman_string( const char *native_lanman )
void set_remote_arch(enum remote_arch_types type)
{
+ extern fstring remote_arch;
ra_type = type;
switch( type ) {
case RA_WFWG:
@@ -2161,12 +2172,8 @@ BOOL reg_split_key(const char *full_keyname, uint32 *reg_type, char *key_name)
if (strequal(tmp, "HKLM") || strequal(tmp, "HKEY_LOCAL_MACHINE"))
(*reg_type) = HKEY_LOCAL_MACHINE;
- else if (strequal(tmp, "HKCR") || strequal(tmp, "HKEY_CLASSES_ROOT"))
- (*reg_type) = HKEY_CLASSES_ROOT;
else if (strequal(tmp, "HKU") || strequal(tmp, "HKEY_USERS"))
(*reg_type) = HKEY_USERS;
- else if (strequal(tmp, "HKPD")||strequal(tmp, "HKEY_PERFORMANCE_DATA"))
- (*reg_type) = HKEY_PERFORMANCE_DATA;
else {
DEBUG(10,("reg_split_key: unrecognised hive key %s\n", tmp));
return False;
@@ -2462,23 +2469,7 @@ BOOL mask_match(const char *string, char *pattern, BOOL is_case_sensitive)
if (strcmp(pattern,".") == 0)
return False;
- return ms_fnmatch(pattern, string, Protocol <= PROTOCOL_LANMAN2, is_case_sensitive) == 0;
-}
-
-/*******************************************************************
- A wrapper that handles case sensitivity and the special handling
- of the ".." name. Varient that is only called by old search code which requires
- pattern translation.
-*******************************************************************/
-
-BOOL mask_match_search(const char *string, char *pattern, BOOL is_case_sensitive)
-{
- if (strcmp(string,"..") == 0)
- string = ".";
- if (strcmp(pattern,".") == 0)
- return False;
-
- return ms_fnmatch(pattern, string, True, is_case_sensitive) == 0;
+ return ms_fnmatch(pattern, string, Protocol, is_case_sensitive) == 0;
}
/*******************************************************************