[SSSD] [PATCH] Add pl translation

2009-09-16 Thread Stephen Gallagher
I haven't gotten Transifex to send the patches to the sssd-devel list
yet, so I'm forwarding this one on manually for the moment.

I give it an Ack, and a thank-you to Piotr Drąg


-- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From eff9496a64fbb38b321519099fe1b5d555f19e3a Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Piotr=20Dr=C4=85g?= piotrd...@gmail.com
Date: Wed, 16 Sep 2009 11:37:24 -0400
Subject: [PATCH] Add pl translation

---
 server/po/pl.po |  261 +++
 sss_client/po/pl.po |   30 ++
 2 files changed, 291 insertions(+), 0 deletions(-)
 create mode 100644 server/po/pl.po
 create mode 100644 sss_client/po/pl.po

diff --git a/server/po/pl.po b/server/po/pl.po
new file mode 100644
index 000..123c1ff
--- /dev/null
+++ b/server/po/pl.po
@@ -0,0 +1,261 @@
+# translation of pl.po to Polish
+# Piotr Drąg piotrd...@gmail.com, 2009.
+#
+msgid 
+msgstr 
+Project-Id-Version: pl\n
+Report-Msgid-Bugs-To: sssd-de...@lists.fedorahosted.org\n
+POT-Creation-Date: 2009-08-24 14:04-0400\n
+PO-Revision-Date: 2009-09-16 17:20+0200\n
+Last-Translator: Piotr Drąg piotrd...@gmail.com\n
+Language-Team: Polish fedora-trans...@redhat.com\n
+MIME-Version: 1.0\n
+Content-Type: text/plain; charset=UTF-8\n
+Content-Transfer-Encoding: 8bit\n
+
+#: tools/sss_groupdel.c:157 tools/sss_groupmod.c:320 tools/sss_userdel.c:158
+#: tools/sss_useradd.c:336 tools/sss_groupadd.c:150 tools/sss_usermod.c:374
+msgid The debug level to run with
+msgstr Poziom debugowania, z jakim uruchomić
+
+#: tools/sss_groupdel.c:166 tools/sss_groupmod.c:345 tools/sss_userdel.c:167
+#: tools/sss_useradd.c:358 tools/sss_groupadd.c:168 tools/sss_usermod.c:402
+msgid Error setting the locale\n
+msgstr Błąd podczas ustawiania lokalizacji\n
+
+#: tools/sss_groupdel.c:175 tools/sss_groupmod.c:354 tools/sss_userdel.c:176
+#: tools/sss_useradd.c:367 tools/sss_groupadd.c:177 tools/sss_usermod.c:411
+msgid Error initializing the tools\n
+msgstr Błąd podczas inicjowania narzędzi\n
+
+#: tools/sss_groupdel.c:183 tools/sss_groupmod.c:362 tools/sss_userdel.c:184
+#: tools/sss_useradd.c:375 tools/sss_usermod.c:419 tools/sss_usermod.c:428
+msgid Out of memory\n
+msgstr Brak pamięci\n
+
+#: tools/sss_groupdel.c:202
+msgid Specify group to delete\n
+msgstr Podaj grupę do usunięcia\n
+
+#: tools/sss_groupdel.c:222 tools/sss_groupmod.c:282 tools/sss_groupmod.c:422
+#: tools/sss_userdel.c:222 tools/sss_useradd.c:485 tools/sss_groupadd.c:220
+#: tools/sss_usermod.c:304 tools/sss_usermod.c:320 tools/sss_usermod.c:487
+msgid Cannot get domain info\n
+msgstr Nie można uzyskać informacji o domenie\n
+
+#: tools/sss_groupdel.c:227 tools/sss_groupmod.c:427 tools/sss_groupadd.c:225
+#, c-format
+msgid Selected domain %s conflicts with selected GID %llu\n
+msgstr Wybrana domena %s jest w konflikcie z wybranym GID %llu\n
+
+#: tools/sss_groupdel.c:244 tools/sss_groupmod.c:444
+msgid Cannot delete group from domain using the legacy tools\n
+msgstr Nie można usunąć grupy z domeny używając przestarzałych 
narzędzi\n
+
+#: tools/sss_groupdel.c:251 tools/sss_groupmod.c:449 tools/sss_groupadd.c:247
+msgid The selected GID is outside all domain ranges\n
+msgstr Wybrany GID jest spoza wszystkich zakresów domeny\n
+
+#: tools/sss_groupdel.c:257 tools/sss_groupmod.c:455 tools/sss_userdel.c:257
+#: tools/sss_useradd.c:518 tools/sss_usermod.c:521
+msgid Unsupported domain type\n
+msgstr Nieobsługiwany typ domeny\n
+
+#: tools/sss_groupdel.c:263 tools/sss_groupmod.c:461 tools/sss_userdel.c:263
+#: tools/sss_useradd.c:524 tools/sss_groupadd.c:259 tools/sss_usermod.c:527
+msgid Error looking up domain\n
+msgstr Błąd podczas wyszukiwania domeny\n
+
+#: tools/sss_groupdel.c:272
+msgid Transaction error. Could not remove group.\n
+msgstr Błąd transakcji. Nie można usunąć grupy.\n
+
+#: tools/sss_groupdel.c:293 tools/sss_userdel.c:293
+msgid No such user\n
+msgstr Nie ma takiego użytkownika\n
+
+#: tools/sss_groupdel.c:297
+msgid Internal error. Could not remove group.\n
+msgstr Wewnętrzny błąd. Nie można usunąć grupy.\n
+
+#: tools/sss_groupmod.c:274
+msgid Group nesting is not supported in this domain\n
+msgstr Zagnieżdżanie grupy nie jest obsługiwane w tej domenie\n
+
+#: tools/sss_groupmod.c:289 tools/sss_usermod.c:327
+msgid Changing gid only allowed inside the same domain\n
+msgstr Zmienianie GOD jest dozwolone tylko w tej samej domenie\n
+
+#: tools/sss_groupmod.c:322
+msgid Groups to add this group to
+msgstr Grupy, do których dodać tę grupę
+
+#: tools/sss_groupmod.c:324
+msgid Groups to remove this group from
+msgstr Grupy, z których usunąć tę grupę
+
+#: tools/sss_groupmod.c:326 tools/sss_groupadd.c:152
+msgid The GID of the group
+msgstr GID grupy
+
+#: tools/sss_groupmod.c:401
+msgid Specify group to modify\n
+msgstr Podaj grupę do zmodyfikowania\n
+
+#: tools/sss_groupmod.c:469 tools/sss_groupmod.c:492
+msgid Transaction error. Could 

Re: [SSSD] [PATCH] Add pl translation

2009-09-16 Thread Stephen Gallagher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/16/2009 11:40 AM, Stephen Gallagher wrote:
 I haven't gotten Transifex to send the patches to the sssd-devel list
 yet, so I'm forwarding this one on manually for the moment.
 
 I give it an Ack, and a thank-you to Piotr Drąg
 
 
 
 
 
 
 ___
 sssd-devel mailing list
 sssd-devel@lists.fedorahosted.org
 https://fedorahosted.org/mailman/listinfo/sssd-devel

Pushed to master.


- -- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkqxIJMACgkQeiVVYja6o6McHACeNcBwjAEaCMXvNmjl5J6m7+M1
V8cAnAhzw/6f3z3t80e+5YeGET7+tI1l
=lzh1
-END PGP SIGNATURE-
___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCH] ELAPI: Fix dispatcher structure initialization

2009-09-16 Thread Dmitri Pal
Guys,

This is great, thank you for finding it.
But this will really mess up my merges.
Can it be undone?
Also I have a ticket open to explicitly return to this part of code and
sort things out with valgrind.
Thanks for finding the answer and cause of the problem, it will make the
fixes simple
but would it possible next time to ask me first or at least wait for my
comment
or ack before pushing?
I have not fell off the planet at least yet...

Thanks
Dmitri

Stephen Gallagher wrote:
 On 09/16/2009 11:53 AM, Stephen Gallagher wrote:
  On 09/16/2009 11:52 AM, Jakub Hrozek wrote:
  On 09/16/2009 05:35 PM, Martin Nagy wrote:
  Obviously, valgrind was producing warnings precisely because of
 the bug
  that Jakub's patch fixes. Therefore it was right to complain. I think
  the right thing to do right now is to remove all the explicit
  initializations and the comment about valgrind complaints.
  That is absolutely correct, I even verified this with valgrind. New
  patch attached.
  Jakub
  Ack

  

  ___
  sssd-devel mailing list
  sssd-devel@lists.fedorahosted.org
  https://fedorahosted.org/mailman/listinfo/sssd-devel



 Pushed to master.
 ___
 sssd-devel mailing list
 sssd-devel@lists.fedorahosted.org
 https://fedorahosted.org/mailman/listinfo/sssd-devel

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

-- 
Thank you,
Dmitri Pal

Engineering Manager IPA project,
Red Hat Inc.


---
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCH] Add pl translation

2009-09-16 Thread Stephen Gallagher
On 09/16/2009 01:29 PM, Stephen Gallagher wrote:
 On 09/16/2009 11:40 AM, Stephen Gallagher wrote:
 I haven't gotten Transifex to send the patches to the sssd-devel list
 yet, so I'm forwarding this one on manually for the moment.
 
 I give it an Ack, and a thank-you to Piotr Drg
 
 
 
 
 
 
 ___
 sssd-devel mailing list
 sssd-devel@lists.fedorahosted.org
 https://fedorahosted.org/mailman/listinfo/sssd-devel
 
 Pushed to master.
 
 

Mea culpa. Turns out the patch was incomplete. It needs the language
added to LINGUAS as well. See attached patch.

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

-- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From 411e2339b0b0b407afa6cb9f31acb651584fac05 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher sgall...@redhat.com
Date: Wed, 16 Sep 2009 14:27:28 -0400
Subject: [PATCH] Add missing updates to LINGUAS for pl translation

---
 server/po/LINGUAS |1 +
 sss_client/po/LINGUAS |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/server/po/LINGUAS b/server/po/LINGUAS
index 8357fca..1a58554 100644
--- a/server/po/LINGUAS
+++ b/server/po/LINGUAS
@@ -1 +1,2 @@
 es
+pl
diff --git a/sss_client/po/LINGUAS b/sss_client/po/LINGUAS
index 8357fca..1a58554 100644
--- a/sss_client/po/LINGUAS
+++ b/sss_client/po/LINGUAS
@@ -1 +1,2 @@
 es
+pl
-- 
1.6.2.5



signature.asc
Description: OpenPGP digital signature
___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCH] Add pl translation

2009-09-16 Thread Stephen Gallagher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/16/2009 02:41 PM, Sumit Bose wrote:
 On Wed, Sep 16, 2009 at 02:29:09PM -0400, Stephen Gallagher wrote:
 On 09/16/2009 01:29 PM, Stephen Gallagher wrote:
 On 09/16/2009 11:40 AM, Stephen Gallagher wrote:
 I haven't gotten Transifex to send the patches to the sssd-devel list
 yet, so I'm forwarding this one on manually for the moment.

 I give it an Ack, and a thank-you to Piotr Drg




 

 ___
 sssd-devel mailing list
 sssd-devel@lists.fedorahosted.org
 https://fedorahosted.org/mailman/listinfo/sssd-devel

 Pushed to master.



 Mea culpa. Turns out the patch was incomplete. It needs the language
 added to LINGUAS as well. See attached patch.

 ACK
 
 bye,
 Sumit
 ___
 sssd-devel mailing list
 sssd-devel@lists.fedorahosted.org
 https://fedorahosted.org/mailman/listinfo/sssd-devel

Pushed to master.

- -- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkqxMfkACgkQeiVVYja6o6ObJwCcDl9TN5ock4973R0yJShNYBg1
uy0An1MwOb5Ji+Za/zWrjWyCPI8qJsGK
=F1ef
-END PGP SIGNATURE-
___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCH] ELAPI: Fix dispatcher structure initialization

2009-09-16 Thread Simo Sorce
On Wed, 2009-09-16 at 14:33 -0400, Stephen Gallagher wrote:
 Dmitri, it's a very simple change that will be very easy to resolve
 with
 'git rebase' and 'git mergetool'.
 
 There's no reason that a complete fix should be held back for the
 convenience of any one developer.
 
 Also, no. The upstream SSSD repository is one-way. To remove it, we
 would have to apply a negative diff and commit that. We're not going
 to
 remove a solid fix because it might inconvenience you.

Steve,
it doesn't make sense to revert now, but in general I agree with Dmitri
that it is at least polite to wait and have a say from the main
maintainer of the code before pushing a patch.
Unless it is blocking other developers or is urgent for any other
reasonable motive.


Simo.

-- 
Simo Sorce * Red Hat, Inc * New York

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCHES] Collection related patches

2009-09-16 Thread Jakub Hrozek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/15/2009 09:20 PM, Dmitri Pal wrote:
 1) Comparison and sorting collections

Did you maybe forget to git-add a file? Makefile.am references
collection_cmp.c but that file is in none of the patches.

Jakub
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkqxOiAACgkQHsardTLnvCUCRgCaAgiPQptZVUBfyImGTnXQpnVU
kcIAoME4ZUZIqkozJqZe0xy4e1YsOnG+
=EF9h
-END PGP SIGNATURE-
___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCH] proxy bug

2009-09-16 Thread Simo Sorce
On Wed, 2009-09-16 at 08:48 -0400, Simo Sorce wrote:
  Please make it a macro or a subroutine instead of adding it three
 times.
 
 Yeah, will do.

Ok new patches attached, with members debug turned into a macro.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
From b11ab80038ec140b0b6e5a4dfa6d2e7ff0dd99bf Mon Sep 17 00:00:00 2001
From: Simo Sorce sso...@redhat.com
Date: Tue, 15 Sep 2009 10:37:25 -0400
Subject: [PATCH 1/2] Fix copypaste error.

---
 server/providers/proxy.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/providers/proxy.c b/server/providers/proxy.c
index 1436a63..8678856 100644
--- a/server/providers/proxy.c
+++ b/server/providers/proxy.c
@@ -1062,7 +1062,7 @@ static void get_gr_gid_process(struct tevent_req *subreq)
 char *buffer;
 char *newbuf;
 size_t buflen;
-bool delete_user = false;
+bool delete_group = false;
 int ret;
 
 ret = sysdb_transaction_recv(subreq, state, state-handle);
@@ -1108,14 +1108,14 @@ again:
 
 case NSS_STATUS_NOTFOUND:
 
-delete_user = true;
+delete_group = true;
 break;
 
 case NSS_STATUS_SUCCESS:
 
 /* gid=0 is an invalid value */
 if (state-grp-gr_gid == 0) {
-delete_user = true;
+delete_group = true;
 break;
 }
 
@@ -1144,7 +1144,7 @@ again:
 return;
 }
 
-if (delete_user) {
+if (delete_group) {
 subreq = sysdb_delete_group_by_gid_send(state, state-ev,
 state-handle,
 state-domain,
-- 
1.6.2.5

From 2e07f3f7ed253b7bb10d8c7c9922e6cffc983cd7 Mon Sep 17 00:00:00 2001
From: Simo Sorce sso...@redhat.com
Date: Tue, 15 Sep 2009 17:41:09 -0400
Subject: [PATCH 2/2] Better handle groups w/o members

There was a chance that groups w/o members could end up causing a failure to
store the group. This would happen in case the structure used by glibc to fill
up the group data was dirty. Always memset structures before passing them to
te libc and also check if there are any members, before calling the async
function.
Finally add some tracing at level 7 so that it is easier to follow what is going
on in case of touble.
---
 server/providers/proxy.c |  128 +++--
 1 files changed, 122 insertions(+), 6 deletions(-)

diff --git a/server/providers/proxy.c b/server/providers/proxy.c
index 8678856..80a2a55 100644
--- a/server/providers/proxy.c
+++ b/server/providers/proxy.c
@@ -361,6 +361,8 @@ static void get_pw_name_process(struct tevent_req *subreq)
 bool delete_user = false;
 int ret;
 
+DEBUG(7, (Searching user by name (%s)\n, state-name));
+
 ret = sysdb_transaction_recv(subreq, state, state-handle);
 if (ret) {
 tevent_req_error(req, ret);
@@ -389,11 +391,16 @@ static void get_pw_name_process(struct tevent_req *subreq)
 switch (status) {
 case NSS_STATUS_NOTFOUND:
 
+DEBUG(7, (User %s not found.\n, state-name));
 delete_user = true;
 break;
 
 case NSS_STATUS_SUCCESS:
 
+DEBUG(7, (User %s found: (%s, %d, %d)\n,
+  state-name, state-pwd-pw_name,
+  state-pwd-pw_uid, state-pwd-pw_gid));
+
 /* uid=0 or gid=0 are invalid values */
 if (state-pwd-pw_uid == 0 || state-pwd-pw_gid == 0) {
 delete_user = true;
@@ -431,6 +438,9 @@ static void get_pw_name_process(struct tevent_req *subreq)
 if (delete_user) {
 struct ldb_dn *dn;
 
+DEBUG(7, (User %s does not exist (or is invalid) on remote server,
+   deleting!\n, state-name));
+
 dn = sysdb_user_dn(state-sysdb, state,
state-domain-name, state-name);
 if (!dn) {
@@ -542,6 +552,8 @@ static void get_pw_uid_process(struct tevent_req *subreq)
 bool delete_user = false;
 int ret;
 
+DEBUG(7, (Searching user by uid (%d)\n, state-uid));
+
 ret = sysdb_transaction_recv(subreq, state, state-handle);
 if (ret) {
 tevent_req_error(req, ret);
@@ -562,17 +574,25 @@ static void get_pw_uid_process(struct tevent_req *subreq)
 return;
 }
 
+/* always zero out the pwd structure */
+memset(state-pwd, 0, sizeof(struct passwd));
+
 status = ctx-ops.getpwuid_r(state-uid, state-pwd,
  buffer, buflen, ret);
 
 switch (status) {
 case NSS_STATUS_NOTFOUND:
 
+DEBUG(7, (User %d not found.\n, state-uid));
 delete_user = true;
 break;
 
 case NSS_STATUS_SUCCESS:
 
+DEBUG(7, (User %d found (%s, %d, %d)\n,
+  state-uid, state-pwd-pw_name,
+  state-pwd-pw_uid, state-pwd-pw_gid));
+
 /* uid=0 or gid=0 are invalid values */
 if (state-pwd-pw_uid == 0 || state-pwd-pw_gid == 0) {
 delete_user = true;
@@ -608,6 +628,9 @@ static void get_pw_uid_process(struct 

Re: [SSSD] [PATCH] ELAPI: Fix dispatcher structure initialization

2009-09-16 Thread Dmitri Pal
Simo Sorce wrote:
 On Wed, 2009-09-16 at 14:33 -0400, Stephen Gallagher wrote:
   
 Dmitri, it's a very simple change that will be very easy to resolve
 with
 'git rebase' and 'git mergetool'.

 There's no reason that a complete fix should be held back for the
 convenience of any one developer.

 Also, no. The upstream SSSD repository is one-way. To remove it, we
 would have to apply a negative diff and commit that. We're not going
 to
 remove a solid fix because it might inconvenience you.
 

 Steve,
 it doesn't make sense to revert now, but in general I agree with Dmitri
 that it is at least polite to wait and have a say from the main
 maintainer of the code before pushing a patch.
 Unless it is blocking other developers or is urgent for any other
 reasonable motive.


 Simo.

   
Thank you Simo for support.
A rare occasion when we are in agreement!
The main point is (thought it will make my merge more complex, I can
deal with it using merge tools as you said),
but this or similar change has to be done in  5-6 other places so rather
than push a separate patch that addresses
just one problem it should be addressed by fixing a corresponding
ticket. https://fedorahosted.org/sssd/ticket/161.
This all could have been discussed before the push and best approach
could have been sorted out.

I will send the patches later today if I have time...

-- 
Thank you,
Dmitri Pal

Engineering Manager IPA project,
Red Hat Inc.


---
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCHES] Collection related patches

2009-09-16 Thread Dmitri Pal
Jakub Hrozek wrote:
 On 09/15/2009 09:20 PM, Dmitri Pal wrote:
  1) Comparison and sorting collections

 Did you maybe forget to git-add a file? Makefile.am references
 collection_cmp.c but that file is in none of the patches.

 Jakub
Thank you, yes I will resend.

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

-- 
Thank you,
Dmitri Pal

Engineering Manager IPA project,
Red Hat Inc.


---
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel


Re: [SSSD] [PATCHES] Collection related patches

2009-09-16 Thread Dmitri Pal
Dmitri Pal wrote:
 See patch comments for details.
 All three are not massive.
 1) Comparison and sorting collections
 2) Taking part of the code from long module and putting it into a new
 module for readability
 3) Adding new functionality to the module created in previous patch

   
 

 ___
 sssd-devel mailing list
 sssd-devel@lists.fedorahosted.org
 https://fedorahosted.org/mailman/listinfo/sssd-devel
Resending the first patch which (as Jakub noticed) missed the file.
Sorry for inconvenience.

-- 
Thank you,
Dmitri Pal

Engineering Manager IPA project,
Red Hat Inc.


---
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

From a57d1eb89a87a60984ea30b51b676b818183ca15 Mon Sep 17 00:00:00 2001
From: Dmitri Pal d...@redhat.com
Date: Mon, 14 Sep 2009 12:52:23 -0400
Subject: [PATCH] COLLECTION Adding item comparison and sorting

Needed item comparison functions and realized
that the easiest way to test them would be using
sorting. Since there already been a ticket #73
to do that I added function to sort collection
based on different properties of the item.
---
 common/collection/Makefile.am|1 +
 common/collection/collection.c   |2 +-
 common/collection/collection.h   |  107 
 common/collection/collection_cmp.c   |  471 ++
 common/collection/collection_tools.c |2 +-
 common/collection/collection_ut.c|  147 +++-
 common/collection/configure.ac   |7 +
 7 files changed, 732 insertions(+), 5 deletions(-)
 create mode 100644 common/collection/collection_cmp.c

diff --git a/common/collection/Makefile.am b/common/collection/Makefile.am
index 292a9a8..b7cfa60 100644
--- a/common/collection/Makefile.am
+++ b/common/collection/Makefile.am
@@ -26,6 +26,7 @@ libcollection_la_SOURCES = \
 collection_cnv.c \
 collection_queue.c \
 collection_stack.c \
+collection_cmp.c \
 collection.h \
 collection_tools.h \
 collection_priv.h \
diff --git a/common/collection/collection.c b/common/collection/collection.c
index bccb50d..c116f48 100644
--- a/common/collection/collection.c
+++ b/common/collection/collection.c
@@ -28,7 +28,7 @@
 #include config.h
 #include trace.h
 
-/* The collection should use the teal structures */
+/* The collection should use the real structures */
 #include collection_priv.h
 #include collection.h
 
diff --git a/common/collection/collection.h b/common/collection/collection.h
index dc59ea2..b4bbb2a 100644
--- a/common/collection/collection.h
+++ b/common/collection/collection.h
@@ -501,6 +501,113 @@ uint64_t col_get_item_hash(struct collection_item *ci);
  */
 uint64_t col_make_hash(const char *string, int *length);
 
+/* Compare two items.
+ * The second item is evaluated against the first.
+ * Function returns 0 if two items are the same
+ * and non-zero otherwise.
+ * The in_flags is a bit mask that defines
+ * how the items should be compared.
+ * See below the list of conbstants
+ * defined for this purpose.
+ * If items are different they might be orderable
+ * or not. For example one can order items by name
+ * but not by type.
+ * If the result of the function is non-zero
+ * the out_flags (if provided) will be
+ * set to indicate if the second item is greater
+ * then the first.
+ */
+int col_compare_items(struct collection_item *first,
+  struct collection_item *second,
+  unsigned in_flags,
+  unsigned *out_flags);
+
+/* Possible valies for input flags /
+/* How to compare properties?
+ * The following 4 flags are mutually exclusive
+ */
+#define COL_CMPIN_PROP_EQU0x4 /* Properties should be same */
+#define COL_CMPIN_PROP_BEG0x5 /* Properties start same */
+#define COL_CMPIN_PROP_MID0x6 /* One is substring of another */
+#define COL_CMPIN_PROP_END0x7 /* One property ends with another */
+
+/* Make sure that there is a dot.
+ * Useful with _BEG, _MID and _END flags to check that the there is
+ * a dot (if present) in the right place (before, after or both).
+ * For example the first item is named foo.bar and the second
+ * is bar. Using _END the bar will be found but if _DOT flag is
+ * used too the function will also check if there was a . before the found
+ * string in this case.
+ * Ignored in case of _EQU.
+ */
+#define COL_CMPIN_PROP_DOT 0x8
+
+/* Compare property lenghts */
+#define COL_CMPIN_PROP_LEN 0x00010
+
+/* Compare types */
+#define COL_CMPIN_TYPE 0x00020
+
+/* Compare data len */
+#define COL_CMPIN_DATA_LEN 0x00040
+
+/* Compare data (up to the length of the second one)
+ * if type is the same. If type is different
+ * function will assume data is different
+ * without performing actual comparison.
+ */
+#define COL_CMPIN_DATA 0x00080
+

[SSSD] DHASH warnings

2009-09-16 Thread Dmitri Pal
Hi,

Spotted some dhash warnings. Seems like worth fixing especially
shadowing ones...

dhash_test.c: In function ‘main’:
dhash_test.c:288: warning: declaration of ‘i’ shadows a previous local
dhash_test.c:115: warning: shadowed declaration is here
dhash_test.c:312: warning: declaration of ‘i’ shadows a previous local
dhash_test.c:115: warning: shadowed declaration is here
dhash_test.c:332: warning: declaration of ‘i’ shadows a previous local
dhash_test.c:115: warning: shadowed declaration is here
dhash_example.c: In function ‘main’:
dhash_example.c:44: warning: passing argument 2 of ‘new_data’ discards
qualifiers from pointer target type
dhash_example.c:55: warning: assignment discards qualifiers from pointer
target type
dhash_example.c:76: warning: assignment discards qualifiers from pointer
target type
dhash_example.c:94: warning: declaration of ‘my_data’ shadows a previous
local
dhash_example.c:44: warning: shadowed declaration is here
dhash_example.c:105: warning: assignment discards qualifiers from
pointer target type

-- 
Thank you,
Dmitri Pal

Engineering Manager IPA project,
Red Hat Inc.


---
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/

___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel