Re: [Freeipa-devel] [PATCH] 0194 Fix selector of protocol for LSA RPC binding string

2015-08-06 Thread Martin Kosek
On 08/06/2015 10:37 AM, Tomas Babej wrote:
> 
> 
> On 08/05/2015 08:40 PM, Alexander Bokovoy wrote:
>> Hi,
>>
>> attached patch fixes a bug
>> https://bugzilla.redhat.com/show_bug.cgi?id=1249455
>>
>> details are in the commit message.
>>
>>
>>
> 
> Looks good to me, generates bindings strings as described in the BZ.
> 
> Just a readability nitpick, can we get rid of the binding_template
> lambda abstraction and use something like this?
> 
> binding_template=u'%s:%s[%s]'
> return [binding_template % (t, remote_host, o) for t in transports
> for o in options]
> 
> or just plain:
> 
> return [u'%s:%s[%s]' % (t, remote_host, o) for t in transports for o
> in options]
> 
> instead of:
> 
> binding_template=lambda x,y,z: u'%s:%s[%s]' % (x, y, z)
> return [binding_template(t, remote_host, o) for t in transports for
> o in options]
> 
> Tomas
> 

Before pushing, please use
https://fedorahosted.org/freeipa/ticket/5183
as reference. I just cloned it.

Thanks,
Martin

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH] 0194 Fix selector of protocol for LSA RPC binding string

2015-08-06 Thread Alexander Bokovoy


- Original Message -
> 
> 
> On 08/05/2015 08:40 PM, Alexander Bokovoy wrote:
> > Hi,
> > 
> > attached patch fixes a bug
> > https://bugzilla.redhat.com/show_bug.cgi?id=1249455
> > 
> > details are in the commit message.
> > 
> > 
> > 
> 
> Looks good to me, generates bindings strings as described in the BZ.
> 
> Just a readability nitpick, can we get rid of the binding_template
> lambda abstraction and use something like this?
> 
> binding_template=u'%s:%s[%s]'
> return [binding_template % (t, remote_host, o) for t in transports
> for o in options]
> 
> or just plain:
> 
> return [u'%s:%s[%s]' % (t, remote_host, o) for t in transports for o
> in options]
> 
> instead of:
> 
> binding_template=lambda x,y,z: u'%s:%s[%s]' % (x, y, z)
> return [binding_template(t, remote_host, o) for t in transports for
> o in options]
Up to you. :)


-- 
/ Alexander Bokovoy

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH] 0194 Fix selector of protocol for LSA RPC binding string

2015-08-06 Thread Tomas Babej


On 08/05/2015 08:40 PM, Alexander Bokovoy wrote:
> Hi,
> 
> attached patch fixes a bug
> https://bugzilla.redhat.com/show_bug.cgi?id=1249455
> 
> details are in the commit message.
> 
> 
> 

Looks good to me, generates bindings strings as described in the BZ.

Just a readability nitpick, can we get rid of the binding_template
lambda abstraction and use something like this?

binding_template=u'%s:%s[%s]'
return [binding_template % (t, remote_host, o) for t in transports
for o in options]

or just plain:

return [u'%s:%s[%s]' % (t, remote_host, o) for t in transports for o
in options]

instead of:

binding_template=lambda x,y,z: u'%s:%s[%s]' % (x, y, z)
return [binding_template(t, remote_host, o) for t in transports for
o in options]

Tomas

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


[Freeipa-devel] [PATCH] 0194 Fix selector of protocol for LSA RPC binding string

2015-08-05 Thread Alexander Bokovoy

Hi,

attached patch fixes a bug https://bugzilla.redhat.com/show_bug.cgi?id=1249455

details are in the commit message.

--
/ Alexander Bokovoy
From 3e5edd4d8f334c053bf2e216d25b14f40590a7c4 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy 
Date: Wed, 5 Aug 2015 21:33:45 +0300
Subject: [PATCH] Fix selector of protocol for LSA RPC binding string

For Windows Server 2012R2 and others which force SMB2 protocol use
we have to specify right DCE RPC binding options.

For using SMB1 protocol we have to omit specifying SMB2 protocol and
anything else or otherwise SMB1 would be considered a pipe to connect
to. This is by design of a binding string format.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1249455

diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py
index be6313e..f334eef 100644
--- a/ipaserver/dcerpc.py
+++ b/ipaserver/dcerpc.py
@@ -855,8 +855,8 @@ class TrustDomainInstance(object):
 We try NCACN_NP before NCACN_IP_TCP and use SMB2 before SMB1 or 
defaults.
 """
 transports = (u'ncacn_np', u'ncacn_ip_tcp')
-options = ( u'smb2', u'smb1', u'')
-binding_template=lambda x,y,z: u'%s:%s[%s,print]' % (x, y, z)
+options = ( u'smb2,print', u'print')
+binding_template=lambda x,y,z: u'%s:%s[%s]' % (x, y, z)
 return [binding_template(t, remote_host, o) for t in transports for o 
in options]
 
 def retrieve_anonymously(self, remote_host, discover_srv=False, 
search_pdc=False):
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code