Fix regression introduced with 4086ef15b395f1a536fb669af2103a33ecc14de4
authorSimo Sorce <idra@samba.org>
Sun, 13 Jul 2008 01:28:18 +0000 (21:28 -0400)
committerSimo Sorce <idra@samba.org>
Sun, 13 Jul 2008 01:42:23 +0000 (21:42 -0400)
We must not return an error here just because we are offline.
We must instead fix the mappings to the best of our knowledge
(ie mark as mapped, expired ones, and as unmapped, unknown ones)
(This used to be commit 4436272dd4d6cdd223b1dc3d217a97cbe3bc887b)

source3/winbindd/idmap.c

index 7a9462b7fd20389550bf983b5e232190d9bf6e90..95ff923d0faff1f396bba5492fa0181f5f28fed8 100644 (file)
@@ -1361,16 +1361,16 @@ NTSTATUS idmap_unixids_to_sids(struct id_map **ids)
 
        /* let's see if there is any id mapping to be retrieved
         * from the backends */
-       if (bi) {
+       if (bids) {
+               bool online;
+
                /* Only do query if we are online */
-               if ( IS_DOMAIN_OFFLINE(our_domain) ) {
-                       ret = NT_STATUS_FILE_IS_OFFLINE;
-                       goto done;
+               online = !IS_DOMAIN_OFFLINE(our_domain);
+               if (online) {
+                       ret = idmap_backends_unixids_to_sids(bids);
+                       IDMAP_CHECK_RET(ret);
                }
 
-               ret = idmap_backends_unixids_to_sids(bids);
-               IDMAP_CHECK_RET(ret);
-
                /* update the cache */
                for (i = 0; i < bi; i++) {
                        if (bids[i]->status == ID_MAPPED) {
@@ -1388,7 +1388,7 @@ NTSTATUS idmap_unixids_to_sids(struct id_map **ids)
                                 * unmapped and hope next time things will
                                 * settle down. */
                                bids[i]->status = ID_UNMAPPED;
-                       } else { /* unmapped */
+                       } else if (online) { /* unmapped */
                                ret = idmap_cache_set_negative_id(idmap_cache,
                                                                  bids[i]);
                        }
@@ -1478,15 +1478,15 @@ NTSTATUS idmap_sids_to_unixids(struct id_map **ids)
        /* let's see if there is any id mapping to be retrieved
         * from the backends */
        if (bids) {
+               bool online;
+
                /* Only do query if we are online */
-               if ( IS_DOMAIN_OFFLINE(our_domain) ) {
-                       ret = NT_STATUS_FILE_IS_OFFLINE;
-                       goto done;
+               online = !IS_DOMAIN_OFFLINE(our_domain);
+               if (online) {
+                       ret = idmap_backends_sids_to_unixids(bids);
+                       IDMAP_CHECK_RET(ret);
                }
 
-               ret = idmap_backends_sids_to_unixids(bids);
-               IDMAP_CHECK_RET(ret);
-
                /* update the cache */
                for (i = 0; bids[i]; i++) {
                        if (bids[i]->status == ID_MAPPED) {
@@ -1504,7 +1504,7 @@ NTSTATUS idmap_sids_to_unixids(struct id_map **ids)
                                 * unmapped and hope next time things will
                                 * settle down. */
                                bids[i]->status = ID_UNMAPPED;
-                       } else { /* unmapped */
+                       } else if (online) { /* unmapped */
                                ret = idmap_cache_set_negative_sid(idmap_cache,
                                                                   bids[i]);
                        }