Commit e0520cea authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge remote-tracking branch 'origin/cygwin'

parents 67c9b585 30a3eec6
...@@ -539,10 +539,11 @@ class User(object): ...@@ -539,10 +539,11 @@ class User(object):
# XXX: This method shall be no-op in case if all is correctly setup # XXX: This method shall be no-op in case if all is correctly setup
# This method shall check if all is correctly done # This method shall check if all is correctly done
# This method shall not reset groups, just add them # This method shall not reset groups, just add them
grpname = 'grp_' + self.name if sys.platform == 'cygwin' else self.name
try: try:
grp.getgrnam(self.name) grp.getgrnam(grpname)
except KeyError: except KeyError:
callAndRead(['groupadd', self.name]) callAndRead(['groupadd', grpname])
user_parameter_list = ['-d', self.path, '-g', self.name, '-s', user_parameter_list = ['-d', self.path, '-g', self.name, '-s',
'/bin/false'] '/bin/false']
...@@ -713,6 +714,9 @@ class Interface(object): ...@@ -713,6 +714,9 @@ class Interface(object):
except KeyError: except KeyError:
raise ValueError("%s must have at least one IPv6 address assigned" % \ raise ValueError("%s must have at least one IPv6 address assigned" % \
interface_name) interface_name)
if sys.platform == 'cygwin':
for q in address_list:
q.setdefault('netmask', 'FFFF:FFFF:FFFF:FFFF::')
# XXX: Missing implementation of Unique Local IPv6 Unicast Addresses as # XXX: Missing implementation of Unique Local IPv6 Unicast Addresses as
# defined in http://www.rfc-editor.org/rfc/rfc4193.txt # defined in http://www.rfc-editor.org/rfc/rfc4193.txt
# XXX: XXX: XXX: IT IS DISALLOWED TO IMPLEMENT link-local addresses as # XXX: XXX: XXX: IT IS DISALLOWED TO IMPLEMENT link-local addresses as
...@@ -797,7 +801,7 @@ class Interface(object): ...@@ -797,7 +801,7 @@ class Interface(object):
return True return True
# check existence on interface for ipv6 # check existence on interface for ipv6
_, result = callAndRead(['ip', 'addr', 'list', interface_name]) _, result = callAndRead(['ip', '-6', 'addr', 'list', interface_name])
for l in result.split('\n'): for l in result.split('\n'):
if address in l: if address in l:
if 'tentative' in l: if 'tentative' in l:
...@@ -827,7 +831,8 @@ class Interface(object): ...@@ -827,7 +831,8 @@ class Interface(object):
def addIPv4LocalAddress(self, addr=None): def addIPv4LocalAddress(self, addr=None):
"""Adds local IPv4 address in ipv4_local_network""" """Adds local IPv4 address in ipv4_local_network"""
netmask = '255.255.255.255' netmask = '255.255.255.254' if sys.platform == 'cygwin' \
else '255.255.255.255'
local_address_list = self.getIPv4LocalAddressList() local_address_list = self.getIPv4LocalAddressList()
if addr is None: if addr is None:
return self._generateRandomIPv4Address(netmask) return self._generateRandomIPv4Address(netmask)
...@@ -1156,7 +1161,7 @@ class Config(object): ...@@ -1156,7 +1161,7 @@ class Config(object):
except ValueError: except ValueError:
pass pass
except OSError: except OSError:
missing_binary_list.append(b) missing_binary_list.append(b[0])
if missing_binary_list: if missing_binary_list:
raise UsageError('Some required binaries are missing or not ' raise UsageError('Some required binaries are missing or not '
'functional: %s' % (','.join(missing_binary_list), )) 'functional: %s' % (','.join(missing_binary_list), ))
......
...@@ -680,7 +680,7 @@ class Slapgrid(object): ...@@ -680,7 +680,7 @@ class Slapgrid(object):
process_handler = subprocess.Popen(command, process_handler = subprocess.Popen(command,
preexec_fn=lambda: dropPrivileges(uid, gid), preexec_fn=lambda: dropPrivileges(uid, gid),
cwd=cwd, cwd=cwd,
env={}, **kw) env=None if sys.platform == 'cygwin' else {}, **kw)
process_handler.stdin.flush() process_handler.stdin.flush()
process_handler.stdin.close() process_handler.stdin.close()
process_handler.stdin = None process_handler.stdin = None
......
...@@ -95,6 +95,8 @@ class SlapPopen(subprocess.Popen): ...@@ -95,6 +95,8 @@ class SlapPopen(subprocess.Popen):
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
kwargs.update(stdin=subprocess.PIPE) kwargs.update(stdin=subprocess.PIPE)
if sys.platform == 'cygwin' and kwargs.get('env') == {}:
kwargs['env'] = None
subprocess.Popen.__init__(self, *args, **kwargs) subprocess.Popen.__init__(self, *args, **kwargs)
self.stdin.flush() self.stdin.flush()
self.stdin.close() self.stdin.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment