Revision: 27845
          http://sourceforge.net/p/bibdesk/svn/27845
Author:   hofman
Date:     2022-08-27 13:59:00 +0000 (Sat, 27 Aug 2022)
Log Message:
-----------
return nil authentication data when canceled for sharing client, and catch 
resulting NSGenericException, as NSFailedAuthenticationException is never thrown

Modified Paths:
--------------
    trunk/bibdesk/BDSKSharingClient.m

Modified: trunk/bibdesk/BDSKSharingClient.m
===================================================================
--- trunk/bibdesk/BDSKSharingClient.m   2022-08-27 13:45:31 UTC (rev 27844)
+++ trunk/bibdesk/BDSKSharingClient.m   2022-08-27 13:59:00 UTC (rev 27845)
@@ -316,6 +316,14 @@
                     }
                 }
                 
+            } else if([exception respondsToSelector:@selector(name)] && 
[[exception name] isEqual:NSGenericException]){
+                
+                // this is thrown when authentication is canceled
+                OSMemoryBarrier();
+                if(flags.canceledAuthentication == 0){
+                    @throw [NSString stringWithFormat:@"%@: exception \"%@\" 
while connecting to remote server %@", NSStringFromSelector(_cmd), exception, 
[service hostName]];
+                }
+                
             } else {
                 @throw [NSString stringWithFormat:@"%@: exception \"%@\" while 
connecting to remote server %@", NSStringFromSelector(_cmd), exception, 
[service hostName]];
             }
@@ -395,12 +403,12 @@
                 // assume we succeeded; the exception handler for the 
connection will change it back if we fail again
                 OSAtomicCompareAndSwap32Barrier(1, 0, 
&flags.authenticationFailed);
             }else{
+                // nil return, will throw NSGereicException
                 OSAtomicCompareAndSwap32Barrier(0, 1, 
&flags.canceledAuthentication);
             }
         }
     }
-    // doc says we're required to return empty NSData instead of nil
-    return [password sha1Signature] ?: [NSData data];
+    return [password sha1Signature];
 }
 
 // monitor the TXT record in case the server changes password requirements

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to