View | Details | Raw Unified | Return to bug 106335
Collapse All | Expand All

(-)source/client/smbspool.c (-15 / +20 lines)
Lines 70-75 Link Here
70
  FILE		*fp;		/* File to print */
70
  FILE		*fp;		/* File to print */
71
  int		status=0;		/* Status of LPD job */
71
  int		status=0;		/* Status of LPD job */
72
  struct cli_state *cli;	/* SMB interface */
72
  struct cli_state *cli;	/* SMB interface */
73
  char null_str[1];
74
75
  null_str[0] = '\0';
73
76
74
  /* we expect the URI in argv[0]. Detect the case where it is in argv[1] and cope */
77
  /* we expect the URI in argv[0]. Detect the case where it is in argv[1] and cope */
75
  if (argc > 2 && strncmp(argv[0],"smb://", 6) && !strncmp(argv[1],"smb://", 6)) {
78
  if (argc > 2 && strncmp(argv[0],"smb://", 6) && !strncmp(argv[1],"smb://", 6)) {
Lines 158-169 Link Here
158
    if ((password = strchr_m(username, ':')) != NULL)
161
    if ((password = strchr_m(username, ':')) != NULL)
159
      *password++ = '\0';
162
      *password++ = '\0';
160
    else
163
    else
161
      password = "";
164
      password = null_str;
162
  }
165
  }
163
  else
166
  else
164
  {
167
  {
165
    username = "";
168
    username = null_str;
166
    password = "";
169
    password = null_str;
167
    server   = uri + 6;
170
    server   = uri + 6;
168
  }
171
  }
169
172
Lines 226-237 Link Here
226
    {
229
    {
227
      if (getenv("CLASS") == NULL)
230
      if (getenv("CLASS") == NULL)
228
      {
231
      {
229
        fprintf(stderr, "ERROR: Unable to connect to SAMBA host, will retry in 60 seconds...");
232
        fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...");
230
        sleep (60);
233
        sleep (60); /* should just waiting and retrying fix authentication  ??? */
231
      }
234
      }
232
      else
235
      else
233
      {
236
      {
234
        fprintf(stderr, "ERROR: Unable to connect to SAMBA host, trying next printer...");
237
        fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...");
235
        return (1);
238
        return (1);
236
      }
239
      }
237
    }
240
    }
Lines 298-304 Link Here
298
  time_t t = 0;
301
  time_t t = 0;
299
  
302
  
300
  snprintf(user_cache_prefix, CC_MAX_FILE_LEN, "%s%d", CC_PREFIX, uid );
303
  snprintf(user_cache_prefix, CC_MAX_FILE_LEN, "%s%d", CC_PREFIX, uid );
301
  tcdir = opendir( TICKET_CC_DIR );
304
  tcdir = sys_opendir( TICKET_CC_DIR );
302
  if ( tcdir == NULL ) 
305
  if ( tcdir == NULL ) 
303
    return NULL; 
306
    return NULL; 
304
  
307
  
Lines 331-336 Link Here
331
    }
334
    }
332
  }
335
  }
333
336
337
  sys_closedir(tcdir);
338
334
  if ( ticket_file == NULL )
339
  if ( ticket_file == NULL )
335
  {
340
  {
336
    /* no ticket cache found */
341
    /* no ticket cache found */
Lines 423-432 Link Here
423
    return NULL;
428
    return NULL;
424
  }
429
  }
425
    
430
    
426
  if (!cli_send_tconX(cli, share, "?????",password, strlen(password)+1)) 
431
  if (!cli_send_tconX(cli, share, "?????", password, strlen(password)+1)) 
427
  {
432
  {
433
    fprintf(stderr, "ERROR: Tree connect failed (%s)\n", cli_errstr(cli));
428
    cli_shutdown(cli);
434
    cli_shutdown(cli);
429
    fprintf(stderr, "ERROR: Tree connect failed\n" );
430
    return NULL;
435
    return NULL;
431
  }
436
  }
432
    
437
    
Lines 455-469 Link Here
455
460
456
  get_myname(myname);  
461
  get_myname(myname);  
457
462
458
  if ( (username) && ( *username ) && (password) && (*password) ) 
463
  /* See if we have a username first.  This is for backwards compatible 
464
     behavior with 3.0.14a */
465
466
  if ( username &&  *username )
459
  {
467
  {
460
      /* 
461
       * User/password specified in the DEVICE_URI, use those credentials 
462
       * to connect to the server 
463
       */
464
      cli = smb_complete_connection(myname, server, port, username, 
468
      cli = smb_complete_connection(myname, server, port, username, 
465
                                    password, workgroup, share, 0 );
469
                                    password, workgroup, share, 0 );
466
      if (cli ) { return cli; }
470
      if (cli) 
471
        return cli;
467
  }
472
  }
468
  
473
  
469
  /* 
474
  /* 

Return to bug 106335