cfgfiles.py revision 1516
281N/A# The contents of this file are subject to the terms of the 281N/A# Common Development and Distribution License (the "License"). 281N/A# You may not use this file except in compliance with the License. 281N/A# See the License for the specific language governing permissions 281N/A# and limitations under the License. 281N/A# When distributing Covered Code, include this CDDL HEADER in each 281N/A# If applicable, add the following below this CDDL HEADER, with the 281N/A# fields enclosed by brackets "[]" replaced with your own identifying 281N/A# information: Portions Copyright [yyyy] [name of copyright owner] 1507N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 281N/A# Use is subject to license terms. 289N/A# NOTE: This module is inherently posix specific. Care is taken in the modules 289N/A# that use this module to not use it on other operating systems. 281N/A """ Solaris configuration file editor... make it easier to 281N/A modify Solaris line-oriented configuration files from actions """ 281N/A return "CfgFile(%s):%s:%s:%s" % \
281N/A """ given self, return list of lines to be printed. 281N/A default impl preserves orignal + insertion order""" 281N/A# for k, v in dic.iteritems(): 281N/A# self.max_lengths[k] = max(len(v), self.max_lengths[k]) 281N/A """ returns dictionary of default string values - ignores 1507N/A """ update existing record, using orig values if missing 281N/A """ set value of record in file, replacing any previous def. 281N/A for any missing info, use defaults. Will insert new value """ 281N/A # bring in any missing values as defaults if not None 281N/A """ print out values in file format """ 281N/A """Manage the passwd and shadow together. Note that 281N/A {
"username" : (
1,
None),
1507N/A "gcos-field" : (
5,
"& User"),
281N/A {
"username" : (
1,
None),
281N/A "password" : (
2,
"*LK*"),
281N/A """ merge dbs... do passwd file first to get right passwd value""" 281N/A # ignore attempts to set passwd for passwd file 1507N/A """returns next free system (<=99) uid""" 281N/A """ manage the group file""" 281N/A {
"groupname" : (
1,
None),
1507N/A """returns next free system (<=99) gid""" 281N/A """"add named user to group; does not check if user exists""" 281N/A """ remove named user from group """ 281N/A """ return list of additional groups user belongs to """ 281N/A """ If a username is present in this file, it denies that user 281N/A the ability to use ftp""" 281N/A {
"username" : (
1,
None)
281N/A """ returns true if user is allowed to use FTP - ie is NOT in file""" 281N/A """ add specified user to file, removing ability to use ftp""" 281N/A """ remove specified user from file """ 281N/A """ manage the userattr file """ 281N/A {
"username" : (
1,
None),
281N/A """ return tokenized line, with attribute column a dictionary 281N/A """ print out string; replace attribute dictionary with proper 281N/A string and use base class to convert entire record to a string """