Default to crypt mode for unix clients
[openafs.git] / src / afs / afs_conn.c
index bdde19b..92e560c 100644 (file)
@@ -44,7 +44,7 @@
 /* Exported variables */
 afs_rwlock_t afs_xconn;                /* allocation lock for new things */
 afs_rwlock_t afs_xinterface;   /* for multiple client address */
-afs_int32 cryptall = 0;                /* encrypt all communications */
+afs_int32 cryptall = 1;                /* encrypt all communications */
 
 /* some connection macros */
 
@@ -393,6 +393,11 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
 
     *rxconn = NULL;
 
+    if (!sap || ((sap->sa_flags & SRVR_ISDOWN) && !force_if_down)) {
+       /* sa is known down, and we don't want to force it.  */
+       return NULL;
+    }
+
     /* find cached connection */
     ObtainSharedLock(&afs_xconn, 15);
     foundvec = 0;
@@ -453,6 +458,18 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
         return NULL;
     }
 
+    if (tc->refCount > 10000) {
+       static int warned;
+       if (!warned) {
+           warned = 1;
+           afs_warn("afs: Very high afs_conn refCount detected (conn %p, count %d)\n",
+                    tc, (int)tc->refCount);
+           afs_warn("afs: Trying to continue, but this may indicate an issue\n");
+           afs_warn("afs: that may eventually crash the machine. Please file\n");
+           afs_warn("afs: a bug report.\n");
+       }
+    }
+
     if (tu->states & UTokensBad) {
        /* we may still have an authenticated RPC connection here,
         * we'll have to create a new, unauthenticated, connection.
@@ -461,7 +478,7 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
         * bad, but that's somewhat trickier, due to locking
         * constraints (though not impossible).
         */
-       if (tc->id && (rx_SecurityClassOf(tc->id) != 0)) {
+       if (tc->id && (rx_SecurityClassOf(tc->id) != RX_SECIDX_NULL)) {
            tc->forceConnectFS = 1;     /* force recreation of connection */
        }
        tu->states &= ~UHasTokens;      /* remove the authentication info */
@@ -470,7 +487,6 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
     glocked = ISAFS_GLOCK();
     if (tc->forceConnectFS) {
        UpgradeSToWLock(&afs_xconn, 38);
-       csec = (struct rx_securityClass *)0;
        if (tc->id) {
            if (sap->natping == tc)
                sap->natping = NULL;
@@ -502,7 +518,8 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
            rx_SetConnHardDeadTime(tc->id, afs_rx_harddead);
        }
 
-        /* Setting idle dead time to non-zero activates RX_CALL_IDLE errors. */
+        /* Setting idle dead time to non-zero activates idle-dead
+        * RX_CALL_TIMEOUT errors. */
        if (isrep)
            rx_SetConnIdleDeadTime(tc->id, afs_rx_idledead_rep);
        else