diff -up authconfig-6.2.8/authinfo.py.krb5comment authconfig-6.2.8/authinfo.py
--- authconfig-6.2.8/authinfo.py.krb5comment 2015-07-03 11:04:01.174220956 +0200
+++ authconfig-6.2.8/authinfo.py 2015-07-03 11:09:29.329857063 +0200
@@ -1701,6 +1701,7 @@ class AuthInfo:
return False
for line in f:
+ line = line.split('#')[0]
line = line.strip()
# If it's a new section, note which one we're "in".
@@ -3203,7 +3204,7 @@ class AuthInfo:
output += str(bool(self.kerberosKDCviaDNS)).lower()
output += "\n"
# If we haven't encountered a realms section yet...
- if not wroterealms2:
+ if not wroterealms2 and (self.kerberosRealm or self.smbRealm):
if not wroterealms:
output += "[realms]\n"
if not wroterealm:
@@ -3211,7 +3212,7 @@ class AuthInfo:
self.kerberosAdminServer)
if not wrotesmbrealm:
output += krbRealm(self.smbRealm, self.smbServers, "")
- if not wrotedomrealm2:
+ if not wrotedomrealm2 and self.kerberosRealm:
if not wrotedomrealm:
output += "[domain_realm]\n"
if self.kerberosRealm and not wroteourdomrealm: