summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-26 04:27:51 +0000
committerTim Potter <tpot@samba.org>2001-11-26 04:27:51 +0000
commit64dd6c3412f961239ad4c6989aab67250d312c9d (patch)
treeca574f52b73672257cac3a26121cfc7ff05d77a8 /source3/param
parent178f6a64b26d828db6b516392d7072e9c29f6233 (diff)
downloadsamba-64dd6c3412f961239ad4c6989aab67250d312c9d.tar.gz
samba-64dd6c3412f961239ad4c6989aab67250d312c9d.tar.bz2
samba-64dd6c3412f961239ad4c6989aab67250d312c9d.zip
Another merge from appliance-head: in [ug]id_to_sid don't call the
winbind function if the id is obviously going to be local. Cleanup of winbind [ug]id parameter handling. (This used to be commit 4ab9ca31a02b3388aa89a00e0390ea9e4c76283a)
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c70
1 files changed, 60 insertions, 10 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index b967c5b63f..e4e3cfce81 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -525,7 +525,8 @@ static BOOL handle_copy(char *pszParmValue, char **ptr);
static BOOL handle_vfs_object(char *pszParmValue, char **ptr);
static BOOL handle_source_env(char *pszParmValue, char **ptr);
static BOOL handle_netbios_name(char *pszParmValue, char **ptr);
-static BOOL handle_winbind_id(char *pszParmValue, char **ptr);
+static BOOL handle_winbind_uid(char *pszParmValue, char **ptr);
+static BOOL handle_winbind_gid(char *pszParmValue, char **ptr);
static BOOL handle_wins_server_list(char *pszParmValue, char **ptr);
static BOOL handle_debug_list( char *pszParmValue, char **ptr );
@@ -1027,8 +1028,8 @@ static struct parm_struct parm_table[] = {
{"Winbind options", P_SEP, P_SEPARATOR},
- {"winbind uid", P_STRING, P_GLOBAL, &Globals.szWinbindUID, handle_winbind_id, NULL, 0},
- {"winbind gid", P_STRING, P_GLOBAL, &Globals.szWinbindGID, handle_winbind_id, NULL, 0},
+ {"winbind uid", P_STRING, P_GLOBAL, &Globals.szWinbindUID, handle_winbind_uid, NULL, 0},
+ {"winbind gid", P_STRING, P_GLOBAL, &Globals.szWinbindGID, handle_winbind_gid, NULL, 0},
{"template homedir", P_STRING, P_GLOBAL, &Globals.szTemplateHomedir, NULL, NULL, 0},
{"template shell", P_STRING, P_GLOBAL, &Globals.szTemplateShell, NULL, NULL, 0},
{"winbind separator", P_STRING, P_GLOBAL, &Globals.szWinbindSeparator, NULL, NULL, 0},
@@ -1497,8 +1498,6 @@ FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
FN_GLOBAL_LIST(lp_domain_admin_group, &Globals.szDomainAdminGroup)
FN_GLOBAL_LIST(lp_domain_guest_group, &Globals.szDomainGuestGroup)
-FN_GLOBAL_STRING(lp_winbind_uid, &Globals.szWinbindUID)
-FN_GLOBAL_STRING(lp_winbind_gid, &Globals.szWinbindGID)
FN_GLOBAL_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
FN_GLOBAL_STRING(lp_template_shell, &Globals.szTemplateShell)
FN_GLOBAL_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
@@ -2447,21 +2446,72 @@ static BOOL handle_copy(char *pszParmValue, char **ptr)
***************************************************************************/
-/* Do some simple checks on "winbind [ug]id" parameter value */
+/* Some lp_ routines to return winbind [ug]id information */
-static BOOL handle_winbind_id(char *pszParmValue, char **ptr)
+static uid_t winbind_uid_low, winbind_uid_high;
+static gid_t winbind_gid_low, winbind_gid_high;
+
+BOOL lp_winbind_uid(uid_t *low, uid_t *high)
+{
+ if (winbind_uid_low == 0 || winbind_uid_high == 0)
+ return False;
+
+ if (low)
+ *low = winbind_uid_low;
+
+ if (high)
+ *high = winbind_uid_high;
+
+ return True;
+}
+
+BOOL lp_winbind_gid(gid_t *low, gid_t *high)
+{
+ if (winbind_gid_low == 0 || winbind_gid_high == 0)
+ return False;
+
+ if (low)
+ *low = winbind_gid_low;
+
+ if (high)
+ *high = winbind_gid_high;
+
+ return True;
+}
+
+/* Do some simple checks on "winbind [ug]id" parameter values */
+
+static BOOL handle_winbind_uid(char *pszParmValue, char **ptr)
{
int low, high;
- if (sscanf(pszParmValue, "%d-%d", &low, &high) != 2)
- {
+ if (sscanf(pszParmValue, "%d-%d", &low, &high) != 2 || high < low)
return False;
- }
/* Parse OK */
string_set(ptr, pszParmValue);
+ winbind_uid_low = low;
+ winbind_uid_high = high;
+
+ return True;
+}
+
+static BOOL handle_winbind_gid(char *pszParmValue, char **ptr)
+{
+ gid_t low, high;
+
+ if (sscanf(pszParmValue, "%d-%d", &low, &high) != 2 || high < low)
+ return False;
+
+ /* Parse OK */
+
+ string_set(ptr, pszParmValue);
+
+ winbind_gid_low = low;
+ winbind_gid_high = high;
+
return True;
}