Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 283011 Details for
Bug 418561
[Patch] add support to tdbsam backend
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch for sambaUserData.py
scs-sambauserdata-stokes-1.patch (text/plain), 4.86 KB, created by
Adam Stokes
on 2007-12-10 18:10:20 UTC
(
hide
)
Description:
patch for sambaUserData.py
Filename:
MIME Type:
Creator:
Adam Stokes
Created:
2007-12-10 18:10:20 UTC
Size:
4.86 KB
patch
obsolete
>--- system-config-samba-1.2.39/src/sambaUserData.py 2005-04-01 10:35:37.000000000 -0500 >+++ system-config-samba-stokes/src/sambaUserData.py 2007-12-10 13:02:18.000000000 -0500 >@@ -20,6 +20,8 @@ > import os > import gtk > import mainWindow >+import commands >+import subprocess > > ## > ## I18N >@@ -31,32 +33,49 @@ > gtk.glade.bindtextdomain(domain) > > class SambaUserData: >- def __init__(self, parent): >+ def __init__(self, parent, samba_data): > self.ParentClass = parent > > self.samba_passwd_file = [] > self.samba_users_file = [] > >+ self.samba_data = samba_data >+ self.sections = samba_data.sections >+ self.sections_dict = samba_data.sections_dict >+ > self.readSmbPasswdFile() >- self.readSmbUsersFile() >+ self.readSmbUsersFile() >+ > > def readSmbPasswdFile(self): >- #Let's check to see if smbpasswd exists >- path = '/etc/samba/smbpasswd' >+ # Dont rely completely on default samba settings for passdb backend. >+ section = self.sections_dict["[global]"] >+ passdb_options = {"smbpasswd" : "/etc/samba/smbpasswd", >+ "tdbsam" : "/etc/samba/passdb.tdb"} >+ passdb = section.getKey("passdb backend") >+ cmd = "" >+ if passdb_options.has_key(passdb): >+ path = passdb_options[passdb] >+ if "tdb" in passdb_options[passdb]: >+ cmd = "/usr/bin/pdbedit -L -w" >+ > list = [] > > if os.access(path, os.F_OK) == 1: > #The file exists. Now check to see if we can read it or not >- if os.access(path, os.R_OK) == 1: >- fd = open(path, 'r') >- for line in fd.readlines(): >- if string.strip(line)[0] != "#": >- list.append(line) >- fd.close() >- >+ if cmd: >+ list = commands.getoutput(cmd).split("\n") > self.samba_passwd_file = list > else: >- raise RuntimeError, (_("You do not have permission to read %s." % path)) >+ if os.access(fname, os.R_OK) == 1: >+ fd = open(fname, 'r') >+ for line in fd.readlines(): >+ if string.strip(line)[0] != "#": >+ list.append(line) >+ fd.close() >+ self.samba_passwd_file = list >+ else: >+ raise RuntimeError, (_("You do not have permission to read %s." % path)) > > > def readSmbUsersFile(self): >@@ -89,7 +108,15 @@ > return user_dict > > def writeSmbPasswdFile(self): >- path = '/etc/samba/smbpasswd' >+ section = self.sections_dict["[global]"] >+ passdb_options = {"smbpasswd" : "/etc/samba/smbpasswd", >+ "tdbsam" : "/etc/samba/passdb.tdb"} >+ passdb = section.getKey("passdb backend") >+ if passdb_options.has_key(passdb): >+ path = passdb_options[passdb] >+ if "tdb" in passdb_options[passdb]: >+ cmd = "/usr/bin/pdbedit -L -w" >+ > if os.access(path, os.W_OK) == 1: > fd = open(path, 'w') > elif os.access(path, os.F_OK) == 0: >@@ -132,12 +159,12 @@ > else: > gtk.mainquit() > raise RuntimeError, (_("You do not have permission to write to %s. Program will now exit." % path)) >- >+ > for line in self.samba_users_file: > fd.write(line) > > fd.close() >- >+ > def addUser(self, unix_name, windows_name, password): > line = unix_name + " = " + windows_name + '\n' > self.samba_users_file.append(line) >@@ -147,7 +174,7 @@ > for i in (1, 2): > pipe.write ("%s\n" % (password)) > pipe.close () >- >+ > self.readSmbPasswdFile() > self.readSmbUsersFile() > >@@ -184,7 +211,17 @@ > > def deleteUser(self, name, line): > #Remove the user's line from the smbpasswd file >- self.samba_passwd_file.remove(line) >+ section = self.sections_dict["[global]"] >+ passdb = section.getKey("passdb backend") >+ >+ if passdb == "tdbsam": >+ cmd = "/usr/bin/pdbedit -x %s" % (name,) >+ ret = subprocess.call([cmd],shell=True) >+ if ret: >+ raise RuntimeError, (_("Unable to delete user %s. " \ >+ "Program will now exit." % (name,))) >+ else: >+ self.samba_passwd_file.remove(line) > > #Get a dict of the smbusers file > user_dict = self.getUserDict() >@@ -195,10 +232,10 @@ > self.samba_users_file.remove(user_dict[name]) > > self.writeSmbUsersFile() >- self.writeSmbPasswdFile() >+ #self.writeSmbPasswdFile() > self.readSmbUsersFile() > self.readSmbPasswdFile() >- >+ > > def getWindowsName(self, line): > tokens = string.split(line, '=')
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 418561
:
283011
|
283031