summaryrefslogtreecommitdiffstats
path: root/source/client
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-11-18 14:33:12 +0000
committerGünther Deschner <gd@samba.org>2005-11-18 14:33:12 +0000
commitb1b549451c183aad74e2e7b79dddfc02c9bcbf71 (patch)
treec4a69f25a1b50df9d95ad280193e1d65afe759b0 /source/client
parent3bebdc6480e26e8a5d6a4ded12fa7ef2121cd7a1 (diff)
downloadsamba-b1b549451c183aad74e2e7b79dddfc02c9bcbf71.tar.gz
samba-b1b549451c183aad74e2e7b79dddfc02c9bcbf71.tar.xz
samba-b1b549451c183aad74e2e7b79dddfc02c9bcbf71.zip
r11790: Avoid infinite retry to gather a connection.
Guenther
Diffstat (limited to 'source/client')
-rw-r--r--source/client/smbspool.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/client/smbspool.c b/source/client/smbspool.c
index da517297f71..aff241adeed 100644
--- a/source/client/smbspool.c
+++ b/source/client/smbspool.c
@@ -30,6 +30,7 @@
#define CC_MAX_FILE_PATH_LEN (sizeof(TICKET_CC_DIR)-1)+ CC_MAX_FILE_LEN+2
#define OVERWRITE 1
#define KRB5CCNAME "KRB5CCNAME"
+#define MAX_RETRY_CONNECT 3
/*
@@ -71,6 +72,7 @@ static int smb_print(struct cli_state *, char *, FILE *);
int status=0; /* Status of LPD job */
struct cli_state *cli; /* SMB interface */
char null_str[1];
+ int tries = 0;
null_str[0] = '\0';
@@ -229,17 +231,23 @@ static int smb_print(struct cli_state *, char *, FILE *);
{
if (getenv("CLASS") == NULL)
{
- fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...");
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...\n");
sleep (60); /* should just waiting and retrying fix authentication ??? */
+ tries++;
}
else
{
- fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...");
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...\n");
return (1);
}
}
}
- while (cli == NULL);
+ while ((cli == NULL) && (tries < MAX_RETRY_CONNECT));
+
+ if (cli == NULL) {
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host after (tried %d times)\n", tries);
+ return (1);
+ }
/*
* Now that we are connected to the server, ignore SIGTERM so that we