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 583270 Details for
Bug 813387
zero-length /etc/sysconfig/network file
[?]
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]
Correct creation of temporary file for replacing variables
ipa-client.patch (text/plain), 7.60 KB, created by
Rob Crittenden
on 2012-05-09 13:07:30 UTC
(
hide
)
Description:
Correct creation of temporary file for replacing variables
Filename:
MIME Type:
Creator:
Rob Crittenden
Created:
2012-05-09 13:07:30 UTC
Size:
7.60 KB
patch
obsolete
>From 8e7c812dbe57fd6523bc75bc311cc404630f79f7 Mon Sep 17 00:00:00 2001 >From: Rob Crittenden <rcritten@redhat.com> >Date: Wed, 9 May 2012 09:05:36 -0400 >Subject: [PATCH] Fix method that replaced values in config files. > >It would result in a zero-length file (#813387) >--- > ipa-client.spec | 8 ++++- > ipa-python24.patch | 65 +++++++++++++++++++++++++++++---------------------- > 2 files changed, 43 insertions(+), 30 deletions(-) > >diff --git a/ipa-client.spec b/ipa-client.spec >index 39da0c18e1308f591eb0ed5aaa402b94bdc9814f..9661e23a8fdbac930f5cadb54d8314f101668a03 100644 >--- a/ipa-client.spec >+++ b/ipa-client.spec >@@ -6,7 +6,7 @@ > > Name: ipa-client > Version: 2.1.3 >-Release: 2%{?date}%{?dist} >+Release: 3%{?date}%{?dist} > Summary: IPA authentication for use on clients > > Group: System Environment/Base >@@ -152,8 +152,12 @@ rm -rf %{buildroot} > %ghost %config(noreplace) %{_sysconfdir}/ipa/default.conf > > %changelog >+* Tue May 8 2012 Rob Crittenden <rcritten@redhat.com> - 2.1.3-3 >+- Fix method that replaced values in config files, it would result >+ in a zero-length file (#813387) >+ > * Tue May 1 2012 Rob Crittenden <rcritten@redhat.com> - 2.1.3-2 >-- Only warn if ipa-getkeytab doesn't get all requested enctypes. (#816693) >+- Only warn if ipa-getkeytab doesn't get all requested enctypes. (#818313) > > * Thu Nov 10 2011 Rob Crittenden <rcritten@redhat.com> - 2.1.3-1 > - Rebase to upstream 2.1.3 (#753936) >diff --git a/ipa-python24.patch b/ipa-python24.patch >index 6c97f776c319632c13aa0586cc9d9242af7ca603..e454939e37c978bb9a3e26d6826160ef55c7268f 100644 >--- a/ipa-python24.patch >+++ b/ipa-python24.patch >@@ -1,4 +1,4 @@ >-From 1b88eba1ae402938532537f5d4ea95a48f7e4e10 Mon Sep 17 00:00:00 2001 >+From f9e5f362f1ce03b0a458097151fbc8f9eaefd65b Mon Sep 17 00:00:00 2001 > From: Rob Crittenden <rcritten@redhat.com> > Date: Mon, 14 Nov 2011 14:44:24 -0500 > Subject: [PATCH] Changes to make IPA work on python 2.4. >@@ -6,12 +6,12 @@ Subject: [PATCH] Changes to make IPA work on python 2.4. > --- > ipa-client/ipaclient/ipadiscovery.py | 121 +++++++++++----------- > ipapython/config.py | 6 +- >- ipapython/ipautil.py | 166 +++++++----------------------- >+ ipapython/ipautil.py | 184 +++++++++------------------------ > ipapython/platform/base.py | 190 +++++++++++++++++++++++++++++++++- >- 4 files changed, 291 insertions(+), 192 deletions(-) >+ 4 files changed, 300 insertions(+), 201 deletions(-) > > diff --git a/ipa-client/ipaclient/ipadiscovery.py b/ipa-client/ipaclient/ipadiscovery.py >-index e786e98..9e446b0 100644 >+index e786e98d8d722b7ac55db6f616effd737f920364..9e446b0174718ad8bf1b74495cd2f97969bbc91b 100644 > --- a/ipa-client/ipaclient/ipadiscovery.py > +++ b/ipa-client/ipaclient/ipadiscovery.py > @@ -24,7 +24,7 @@ import ipapython.dnsclient >@@ -159,7 +159,7 @@ index e786e98..9e446b0 100644 > finally: > os.remove("%s/ca.crt" % temp_ca_dir) > diff --git a/ipapython/config.py b/ipapython/config.py >-index d4c724d..ffb2fbf 100644 >+index d4c724dc9ac754cb221fe60d7c13bd0c716dd296..ffb2fbff6a9768c627c2862ee073cde7856bd9d0 100644 > --- a/ipapython/config.py > +++ b/ipapython/config.py > @@ -54,7 +54,7 @@ def check_ip_option(option, opt, value): >@@ -183,7 +183,7 @@ index d4c724d..ffb2fbf 100644 > pass > try: > diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py >-index 718f209..c261dab 100644 >+index 718f209b32649df23177dcab7d5105d01c0cd7bc..e0d6cb4c5426f4e893c9ac3eaad618928448ac9b 100644 > --- a/ipapython/ipautil.py > +++ b/ipapython/ipautil.py > @@ -33,7 +33,7 @@ import os, sys, traceback, readline >@@ -361,9 +361,24 @@ index 718f209..c261dab 100644 > - new_line = u"%s=%s %s\n" % (option, value, appendvars[option]) > - old_values[option] = value > - new_config.write(new_line) >+- # Now add all options from replacevars and appendvars that were not found in the file >+- new_vars = replacevars.copy() >+- new_vars.update(appendvars) >+- newvars_view = set(new_vars.keys()) - set(old_values.keys()) >+- append_view = (set(appendvars.keys()) - set(replacevars.keys())) - set(old_values.keys()) >+- for item in newvars_view: >+- new_config.write("%s=%s\n" % (item,new_vars[item])) >+- for item in append_view: >+- new_config.write("%s=%s\n" % (item,appendvars[item])) >+- new_config.flush() >+- # Make sure the resulting file is readable by others before installing it >+- os.fchmod(new_config.fileno(), orig_stat.st_mode) >+- os.fchown(new_config.fileno(), orig_stat.st_uid, orig_stat.st_gid) >+- >+- # At this point new_config is closed but not removed due to 'delete=False' above > + (new_config_fd, new_config_name) = tempfile.mkstemp() > + temp_filename = new_config_name >-+ f = open(temp_filename, 'r') >++ f = open(filepath, 'r') > + for line in f: > + new_line = line > + m = pattern.match(line) >@@ -382,31 +397,25 @@ index 718f209..c261dab 100644 > + new_line = u"%s=%s %s\n" % (option, value, appendvars[option]) > + old_values[option] = value > + os.write(new_config_fd, new_line) >- # Now add all options from replacevars and appendvars that were not found in the file >- new_vars = replacevars.copy() >- new_vars.update(appendvars) >- newvars_view = set(new_vars.keys()) - set(old_values.keys()) >- append_view = (set(appendvars.keys()) - set(replacevars.keys())) - set(old_values.keys()) >- for item in newvars_view: >-- new_config.write("%s=%s\n" % (item,new_vars[item])) >-+ os.write(new_config_fd, "%s=%s\n" % (item,new_vars[item])) >- for item in append_view: >-- new_config.write("%s=%s\n" % (item,appendvars[item])) >-- new_config.flush() >-+ os.write(new_config_fd, "%s=%s\n" % (item,appendvars[item])) >-+ os.close(new_config_fd) >- # Make sure the resulting file is readable by others before installing it >-- os.fchmod(new_config.fileno(), orig_stat.st_mode) >-- os.fchown(new_config.fileno(), orig_stat.st_uid, orig_stat.st_gid) >-+ os.chmod(new_config_name, orig_stat.st_mode) >-+ os.chown(new_config_name, orig_stat.st_uid, orig_stat.st_gid) >- >-- # At this point new_config is closed but not removed due to 'delete=False' above >++ # Now add all options from replacevars and appendvars that were not found in the file >++ new_vars = replacevars.copy() >++ new_vars.update(appendvars) >++ newvars_view = set(new_vars.keys()) - set(old_values.keys()) >++ append_view = (set(appendvars.keys()) - set(replacevars.keys())) - set(old_values.keys()) >++ for item in newvars_view: >++ os.write(new_config_fd, "%s=%s\n" % (item,new_vars[item])) >++ for item in append_view: >++ os.write(new_config_fd, "%s=%s\n" % (item,appendvars[item])) >++ os.close(new_config_fd) >++ # Make sure the resulting file is readable by others before installing it >++ os.chmod(new_config_name, orig_stat.st_mode) >++ os.chown(new_config_name, orig_stat.st_uid, orig_stat.st_gid) >++ > # Now, install the temporary file as configuration and ensure old version is available as .orig > # While .orig file is not used during uninstall, it is left there for administrator. > install_file(temp_filename, filepath) > diff --git a/ipapython/platform/base.py b/ipapython/platform/base.py >-index f9d4099..c7cd633 100644 >+index f9d409972a61ffc730f1313470fb8c09dc90ed97..c7cd633ec7600b4659e0d8b82e00003e7a4f577b 100644 > --- a/ipapython/platform/base.py > +++ b/ipapython/platform/base.py > @@ -16,7 +16,6 @@ >-- >1.6.0.6 >
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 813387
:
583056
| 583270