From 1811ec9c6177feebff19e5e02a1b26a942d3dcf8 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 10 Aug 2011 13:16:43 +0530 Subject: Bug 3374 - [CIFS] updating volume with a non-existent user succeeds. Added checks to find non-existing user/s Moved CIFS_VOLUME_FILE, CIFS_USER_FILE, DEFAULT_UID to Globals.py Added getCifsUserUid function into Utils.py Fixed typo in grun.py --- .../src/Globals.py | 6 +++++- .../src/Utils.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src/com.gluster.storage.management.gateway.scripts') diff --git a/src/com.gluster.storage.management.gateway.scripts/src/Globals.py b/src/com.gluster.storage.management.gateway.scripts/src/Globals.py index d5cb1ae0..cfab83b6 100644 --- a/src/com.gluster.storage.management.gateway.scripts/src/Globals.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/Globals.py @@ -22,7 +22,7 @@ GLUSTER_PROBE_VERSION = "1.0.0" DEFAULT_BUFSIZE = 1024 SERVER_PORT = 24731 DEFAULT_BACKLOG = 5 -DEFAULT_TIMEOUT = 5 +DEFAULT_TIMEOUT = 3 DEFAULT_ID_LENGTH = 16 GLUSTER_PLATFORM_VERSION = "3.2" @@ -129,3 +129,7 @@ VERSION_DICTONARY = {} AWS_WEB_SERVICE_URL = "http://169.254.169.254/latest" REAL_SAMBA_CONF_FILE = "/etc/samba/real.smb.conf" + +DEFAULT_UID = 1024000 +CIFS_USER_FILE = "/opt/glustermg/etc/users.cifs" +CIFS_VOLUME_FILE = "/opt/glustermg/etc/volumes.cifs" diff --git a/src/com.gluster.storage.management.gateway.scripts/src/Utils.py b/src/com.gluster.storage.management.gateway.scripts/src/Utils.py index 82f8b7b6..be5df757 100644 --- a/src/com.gluster.storage.management.gateway.scripts/src/Utils.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/Utils.py @@ -1084,3 +1084,18 @@ def getGlusterVersion(): if not rv["Stdout"]: return None return rv["Stdout"].strip().split()[1] + +def getCifsUserUid(userName): + try: + fp = open(Globals.CIFS_USER_FILE) + content = fp.read() + fp.close() + except IOError, e: + Utils.log("failed to read file %s: %s" % (Globals.CIFS_USER_FILE, str(e))) + return False + + for line in content.strip().split(): + tokens = line.split(":") + if tokens[1] == userName: + return int(tokens[0]) + return None -- cgit