Changeset 140 for branches/samba-3.0/source/rpc_server
- Timestamp:
- Jul 11, 2008, 1:13:42 AM (17 years ago)
- Location:
- branches/samba-3.0/source/rpc_server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/rpc_server/srv_samr_util.c
r62 r140 279 279 pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); 280 280 } else { 281 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 281 /* A subtlety here: some windows commands will 282 clear the expired flag even though it's not 283 set, and we don't want to reset the time 284 in these caess. "net user /dom <user> /active:y" 285 for example, to clear an autolocked acct. 286 We must check to see if it's expired first. jmcd */ 287 stored_time = pdb_get_pass_last_set_time(to); 288 if (stored_time == 0) 289 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 282 290 } 283 291 } … … 493 501 pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); 494 502 } else { 495 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 503 /* A subtlety here: some windows commands will 504 clear the expired flag even though it's not 505 set, and we don't want to reset the time 506 in these caess. "net user /dom <user> /active:y" 507 for example, to clear an autolocked acct. 508 We must check to see if it's expired first. jmcd */ 509 stored_time = pdb_get_pass_last_set_time(to); 510 if (stored_time == 0) 511 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 496 512 } 497 513 } … … 711 727 pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); 712 728 } else { 713 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 729 /* A subtlety here: some windows commands will 730 clear the expired flag even though it's not 731 set, and we don't want to reset the time 732 in these caess. "net user /dom <user> /active:y" 733 for example, to clear an autolocked acct. 734 We must check to see if it's expired first. jmcd */ 735 stored_time = pdb_get_pass_last_set_time(to); 736 if (stored_time == 0) 737 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 714 738 } 715 739 } -
branches/samba-3.0/source/rpc_server/srv_spoolss_nt.c
r134 r140 74 74 }; 75 75 76 /******************************************************************** 77 * Canonicalize servername. 78 ********************************************************************/ 79 80 static const char *canon_servername(const char *servername) 81 { 82 const char *pservername = servername; 83 while (*pservername == '\\') { 84 pservername++; 85 } 86 return pservername; 87 } 76 88 77 89 /* translate between internal status numbers and NT status numbers */ … … 445 457 aprinter = handlename; 446 458 if ( *handlename == '\\' ) { 447 servername = handlename + 2;448 if ( (aprinter = strchr_m( handlename+2, '\\' )) != NULL ) {459 servername = canon_servername(handlename); 460 if ( (aprinter = strchr_m( servername, '\\' )) != NULL ) { 449 461 *aprinter = '\0'; 450 462 aprinter++; 451 463 } 452 } 453 else { 464 } else { 454 465 servername = ""; 455 466 } … … 4640 4651 ********************************************************************/ 4641 4652 4642 static WERROR enumprinters_level2( uint32 flags, fstringservername,4653 static WERROR enumprinters_level2( uint32 flags, const char *servername, 4643 4654 RPC_BUFFER *buffer, uint32 offered, 4644 4655 uint32 *needed, uint32 *returned) 4645 4656 { 4646 char *s = servername;4647 4648 4657 if (flags & PRINTER_ENUM_LOCAL) { 4649 4658 return enum_all_printers_info_2(buffer, offered, needed, returned); … … 4651 4660 4652 4661 if (flags & PRINTER_ENUM_NAME) { 4653 if ((servername[0] == '\\') && (servername[1] == '\\')) 4654 s = servername + 2; 4655 if (is_myname_or_ipaddr(s)) 4662 if (is_myname_or_ipaddr(canon_servername(servername))) 4656 4663 return enum_all_printers_info_2(buffer, offered, needed, returned); 4657 4664 else … … 4669 4676 ********************************************************************/ 4670 4677 4671 static WERROR enumprinters_level5( uint32 flags, fstringservername,4678 static WERROR enumprinters_level5( uint32 flags, const char *servername, 4672 4679 RPC_BUFFER *buffer, uint32 offered, 4673 4680 uint32 *needed, uint32 *returned) … … 5047 5054 ********************************************************************/ 5048 5055 5049 static void fill_printer_driver_info_1(DRIVER_INFO_1 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstringservername, fstring architecture)5056 static void fill_printer_driver_info_1(DRIVER_INFO_1 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername, fstring architecture) 5050 5057 { 5051 5058 init_unistr( &info->name, driver.info_3->name); … … 5056 5063 ********************************************************************/ 5057 5064 5058 static WERROR construct_printer_driver_info_1(DRIVER_INFO_1 *info, int snum, fstringservername, fstring architecture, uint32 version)5065 static WERROR construct_printer_driver_info_1(DRIVER_INFO_1 *info, int snum, const char *servername, fstring architecture, uint32 version) 5059 5066 { 5060 5067 NT_PRINTER_INFO_LEVEL *printer = NULL; … … 5083 5090 ********************************************************************/ 5084 5091 5085 static void fill_printer_driver_info_2(DRIVER_INFO_2 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstringservername)5092 static void fill_printer_driver_info_2(DRIVER_INFO_2 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername) 5086 5093 { 5087 5094 pstring temp; 5095 const char *cservername = canon_servername(servername); 5088 5096 5089 5097 info->version=driver.info_3->cversion; … … 5094 5102 5095 5103 if (strlen(driver.info_3->driverpath)) { 5096 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->driverpath);5104 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->driverpath); 5097 5105 init_unistr( &info->driverpath, temp ); 5098 5106 } else … … 5100 5108 5101 5109 if (strlen(driver.info_3->datafile)) { 5102 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->datafile);5110 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->datafile); 5103 5111 init_unistr( &info->datafile, temp ); 5104 5112 } else … … 5106 5114 5107 5115 if (strlen(driver.info_3->configfile)) { 5108 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->configfile);5116 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->configfile); 5109 5117 init_unistr( &info->configfile, temp ); 5110 5118 } else … … 5117 5125 ********************************************************************/ 5118 5126 5119 static WERROR construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, fstringservername, fstring architecture, uint32 version)5127 static WERROR construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, const char *servername, fstring architecture, uint32 version) 5120 5128 { 5121 5129 NT_PRINTER_INFO_LEVEL *printer = NULL; … … 5171 5179 5172 5180 if ( servername ) 5173 slprintf( line, sizeof(line)-1, "\\\\%s%s", servername, v );5181 slprintf( line, sizeof(line)-1, "\\\\%s%s", canon_servername(servername), v ); 5174 5182 else 5175 5183 pstrcpy( line, v ); … … 5210 5218 ********************************************************************/ 5211 5219 5212 static void fill_printer_driver_info_3(DRIVER_INFO_3 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstringservername)5220 static void fill_printer_driver_info_3(DRIVER_INFO_3 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername) 5213 5221 { 5214 5222 pstring temp; 5223 const char *cservername = canon_servername(servername); 5215 5224 5216 5225 ZERO_STRUCTP(info); … … 5222 5231 5223 5232 if (strlen(driver.info_3->driverpath)) { 5224 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->driverpath);5233 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->driverpath); 5225 5234 init_unistr( &info->driverpath, temp ); 5226 5235 } else … … 5228 5237 5229 5238 if (strlen(driver.info_3->datafile)) { 5230 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->datafile);5239 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->datafile); 5231 5240 init_unistr( &info->datafile, temp ); 5232 5241 } else … … 5234 5243 5235 5244 if (strlen(driver.info_3->configfile)) { 5236 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->configfile);5245 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->configfile); 5237 5246 init_unistr( &info->configfile, temp ); 5238 5247 } else … … 5240 5249 5241 5250 if (strlen(driver.info_3->helpfile)) { 5242 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->helpfile);5251 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->helpfile); 5243 5252 init_unistr( &info->helpfile, temp ); 5244 5253 } else … … 5249 5258 5250 5259 info->dependentfiles=NULL; 5251 init_unistr_array(&info->dependentfiles, driver.info_3->dependentfiles, servername);5260 init_unistr_array(&info->dependentfiles, driver.info_3->dependentfiles, cservername); 5252 5261 } 5253 5262 … … 5257 5266 ********************************************************************/ 5258 5267 5259 static WERROR construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, fstringservername, fstring architecture, uint32 version)5268 static WERROR construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, const char *servername, fstring architecture, uint32 version) 5260 5269 { 5261 5270 NT_PRINTER_INFO_LEVEL *printer = NULL; … … 5316 5325 ********************************************************************/ 5317 5326 5318 static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstringservername)5327 static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername) 5319 5328 { 5320 5329 pstring temp; 5321 5330 fstring nullstr; 5331 const char *cservername = canon_servername(servername); 5322 5332 5323 5333 ZERO_STRUCTP(info); … … 5330 5340 5331 5341 if (strlen(driver.info_3->driverpath)) { 5332 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->driverpath);5342 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->driverpath); 5333 5343 init_unistr( &info->driverpath, temp ); 5334 5344 } else … … 5336 5346 5337 5347 if (strlen(driver.info_3->datafile)) { 5338 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->datafile);5348 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->datafile); 5339 5349 init_unistr( &info->datafile, temp ); 5340 5350 } else … … 5342 5352 5343 5353 if (strlen(driver.info_3->configfile)) { 5344 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->configfile);5354 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->configfile); 5345 5355 init_unistr( &info->configfile, temp ); 5346 5356 } else … … 5348 5358 5349 5359 if (strlen(driver.info_3->helpfile)) { 5350 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->helpfile);5360 slprintf(temp, sizeof(temp)-1, "\\\\%s%s", cservername, driver.info_3->helpfile); 5351 5361 init_unistr( &info->helpfile, temp ); 5352 5362 } else … … 5380 5390 5381 5391 static WERROR construct_printer_driver_info_6(DRIVER_INFO_6 *info, int snum, 5382 fstringservername, fstring architecture, uint32 version)5392 const char *servername, fstring architecture, uint32 version) 5383 5393 { 5384 5394 NT_PRINTER_INFO_LEVEL *printer = NULL; … … 5447 5457 ****************************************************************************/ 5448 5458 5449 static WERROR getprinterdriver2_level1( fstringservername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)5459 static WERROR getprinterdriver2_level1(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) 5450 5460 { 5451 5461 DRIVER_INFO_1 *info=NULL; … … 5485 5495 ****************************************************************************/ 5486 5496 5487 static WERROR getprinterdriver2_level2( fstringservername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)5497 static WERROR getprinterdriver2_level2(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) 5488 5498 { 5489 5499 DRIVER_INFO_2 *info=NULL; … … 5523 5533 ****************************************************************************/ 5524 5534 5525 static WERROR getprinterdriver2_level3( fstringservername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)5535 static WERROR getprinterdriver2_level3(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) 5526 5536 { 5527 5537 DRIVER_INFO_3 info; … … 5559 5569 ****************************************************************************/ 5560 5570 5561 static WERROR getprinterdriver2_level6( fstringservername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)5571 static WERROR getprinterdriver2_level6(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed) 5562 5572 { 5563 5573 DRIVER_INFO_6 info; … … 6788 6798 ****************************************************************************/ 6789 6799 6790 static WERROR enumprinterdrivers_level1( fstringservername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)6800 static WERROR enumprinterdrivers_level1(const char *servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned) 6791 6801 { 6792 6802 int i; … … 6872 6882 ****************************************************************************/ 6873 6883 6874 static WERROR enumprinterdrivers_level2( fstringservername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)6884 static WERROR enumprinterdrivers_level2(const char *servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned) 6875 6885 { 6876 6886 int i; … … 6957 6967 ****************************************************************************/ 6958 6968 6959 static WERROR enumprinterdrivers_level3( fstringservername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)6969 static WERROR enumprinterdrivers_level3(const char *servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned) 6960 6970 { 6961 6971 int i; … … 7053 7063 uint32 *needed = &r_u->needed; 7054 7064 uint32 *returned = &r_u->returned; 7055 7065 const char *cservername; 7056 7066 fstring servername; 7057 7067 fstring architecture; … … 7074 7084 unistr2_to_ascii(servername, &q_u->name, sizeof(servername)-1); 7075 7085 7076 if ( !is_myname_or_ipaddr( servername ) ) 7086 cservername = canon_servername(servername); 7087 7088 if (!is_myname_or_ipaddr(cservername)) 7077 7089 return WERR_UNKNOWN_PRINTER_DRIVER; 7078 7090 7079 7091 switch (level) { 7080 7092 case 1: 7081 return enumprinterdrivers_level1( servername, architecture, buffer, offered, needed, returned);7093 return enumprinterdrivers_level1(cservername, architecture, buffer, offered, needed, returned); 7082 7094 case 2: 7083 return enumprinterdrivers_level2( servername, architecture, buffer, offered, needed, returned);7095 return enumprinterdrivers_level2(cservername, architecture, buffer, offered, needed, returned); 7084 7096 case 3: 7085 return enumprinterdrivers_level3( servername, architecture, buffer, offered, needed, returned);7097 return enumprinterdrivers_level3(cservername, architecture, buffer, offered, needed, returned); 7086 7098 default: 7087 7099 return WERR_UNKNOWN_LEVEL; … … 7853 7865 pstring long_archi; 7854 7866 fstring servername; 7855 c har *pservername;7867 const char *pservername; 7856 7868 const char *short_archi; 7857 7869 DRIVER_DIRECTORY_1 *info=NULL; … … 7861 7873 unistr2_to_ascii(long_archi, uni_environment, sizeof(long_archi)-1); 7862 7874 7863 /* check for beginning double '\'s and that the server 7864 long enough */ 7865 7866 pservername = servername; 7867 if ( *pservername == '\\' && strlen(servername)>2 ) { 7868 pservername += 2; 7869 } 7875 pservername = canon_servername(servername); 7870 7876 7871 7877 if ( !is_myname_or_ipaddr( pservername ) )
Note:
See TracChangeset
for help on using the changeset viewer.