Print this page
1575 untangle libmlrpc ... pre2:
 Get rid of ndr_rpc_server_{info,os}


 333                             cib1->coni1_netname ?
 334                             (char *)cib1->coni1_netname : "(null)");
 335                         smb_tracef("srvsvc coni1_nopens=%u",
 336                             cib1->coni1_num_opens);
 337                         smb_tracef("srvsvc coni1_time=%u", cib1->coni1_time);
 338                         smb_tracef("srvsvc coni1_num_users=%u",
 339                             cib1->coni1_num_users);
 340                 }
 341                 break;
 342 
 343         default:
 344                 smb_tracef("srvsvc: unknown level");
 345                 break;
 346         }
 347 
 348         srvsvc_close(&handle);
 349         return (0);
 350 }
 351 
 352 /*
 353  * Windows 95+ and Windows NT4.0 both report the version as 4.0.
 354  * Windows 2000+ reports the version as 5.x.
 355  */
 356 int
 357 srvsvc_net_server_getinfo(char *server, char *domain,
 358     srvsvc_server_info_t *svinfo)
 359 {
 360         mlsvc_handle_t handle;
 361         struct mslm_NetServerGetInfo arg;
 362         struct mslm_SERVER_INFO_101 *sv101;
 363         int len, opnum, rc;
 364         char user[SMB_USERNAME_MAXLEN];
 365 
 366         smb_ipc_get_user(user, SMB_USERNAME_MAXLEN);
 367 
 368         if (srvsvc_open(server, domain, user, &handle) != 0)
 369                 return (-1);
 370 
 371         opnum = SRVSVC_OPNUM_NetServerGetInfo;
 372         bzero(&arg, sizeof (arg));
 373 
 374         len = strlen(server) + 4;
 375         arg.servername = ndr_rpc_malloc(&handle, len);
 376         if (arg.servername == NULL)
 377                 return (-1);
 378 
 379         (void) snprintf((char *)arg.servername, len, "\\\\%s", server);
 380         arg.level = 101;
 381 
 382         rc = ndr_rpc_call(&handle, opnum, &arg);
 383         if ((rc != 0) || (arg.status != 0)) {
 384                 srvsvc_close(&handle);
 385                 return (-1);
 386         }
 387 
 388         sv101 = arg.result.bufptr.bufptr101;
 389 
 390         bzero(svinfo, sizeof (srvsvc_server_info_t));
 391         svinfo->sv_platform_id = sv101->sv101_platform_id;
 392         svinfo->sv_version_major = sv101->sv101_version_major;
 393         svinfo->sv_version_minor = sv101->sv101_version_minor;
 394         svinfo->sv_type = sv101->sv101_type;
 395         if (sv101->sv101_name)
 396                 svinfo->sv_name = strdup((char *)sv101->sv101_name);
 397         if (sv101->sv101_comment)
 398                 svinfo->sv_comment = strdup((char *)sv101->sv101_comment);
 399 
 400         if (svinfo->sv_type & SV_TYPE_WFW)
 401                 svinfo->sv_os = NATIVE_OS_WIN95;
 402         if (svinfo->sv_type & SV_TYPE_WINDOWS)
 403                 svinfo->sv_os = NATIVE_OS_WIN95;
 404         if ((svinfo->sv_type & SV_TYPE_NT) ||
 405             (svinfo->sv_type & SV_TYPE_SERVER_NT))
 406                 svinfo->sv_os = NATIVE_OS_WINNT;
 407         if (svinfo->sv_version_major > 4)
 408                 svinfo->sv_os = NATIVE_OS_WIN2000;
 409 
 410         srvsvc_close(&handle);
 411         return (0);
 412 }
 413 
 414 /*
 415  * Compare the time here with the remote time on the server
 416  * and report clock skew.
 417  */
 418 void
 419 srvsvc_timecheck(char *server, char *domain)
 420 {
 421         char                    hostname[MAXHOSTNAMELEN];
 422         struct timeval          dc_tv;
 423         struct tm               dc_tm;
 424         struct tm               *tm;
 425         time_t                  tnow;
 426         time_t                  tdiff;
 427         int                     priority;
 428 
 429         if (srvsvc_net_remote_tod(server, domain, &dc_tv, &dc_tm) < 0) {
 430                 syslog(LOG_DEBUG, "srvsvc_net_remote_tod failed");
 431                 return;
 432         }
 433 
 434         tnow = time(NULL);


 570          */
 571         tod = arg.bufptr;
 572 
 573         if (tv) {
 574                 tv->tv_sec = tod->tod_elapsedt;
 575                 tv->tv_usec = tod->tod_msecs;
 576         }
 577 
 578         if (tm) {
 579                 tm->tm_sec = tod->tod_secs;
 580                 tm->tm_min = tod->tod_mins;
 581                 tm->tm_hour = tod->tod_hours;
 582                 tm->tm_mday = tod->tod_day;
 583                 tm->tm_mon = tod->tod_month - 1;
 584                 tm->tm_year = tod->tod_year - 1900;
 585                 tm->tm_wday = tod->tod_weekday;
 586         }
 587 
 588         srvsvc_close(&handle);
 589         return (0);
 590 }
 591 
 592 void
 593 srvsvc_net_test(char *server, char *domain, char *netname)
 594 {
 595         smb_domainex_t di;
 596         srvsvc_server_info_t svinfo;
 597 
 598         (void) smb_tracef("%s %s %s", server, domain, netname);
 599 
 600         if (smb_domain_getinfo(&di)) {
 601                 server = di.d_dci.dc_name;
 602                 domain = di.d_primary.di_nbname;
 603         }
 604 
 605         if (srvsvc_net_server_getinfo(server, domain, &svinfo) == 0) {
 606                 smb_tracef("NetServerGetInfo: %s %s (%d.%d) id=%d type=0x%08x",
 607                     svinfo.sv_name ? svinfo.sv_name : "NULL",
 608                     svinfo.sv_comment ? svinfo.sv_comment : "NULL",
 609                     svinfo.sv_version_major, svinfo.sv_version_minor,
 610                     svinfo.sv_platform_id, svinfo.sv_type);
 611 
 612                 free(svinfo.sv_name);
 613                 free(svinfo.sv_comment);
 614         }
 615 
 616         (void) srvsvc_net_share_get_info(server, domain, netname);
 617 #if 0
 618         /*
 619          * The NetSessionEnum server-side definition was updated.
 620          * Disabled until the client-side has been updated.
 621          */
 622         (void) srvsvc_net_session_enum(server, domain, netname);
 623 #endif
 624         (void) srvsvc_net_connect_enum(server, domain, netname, 0);
 625         (void) srvsvc_net_connect_enum(server, domain, netname, 1);
 626 }


 333                             cib1->coni1_netname ?
 334                             (char *)cib1->coni1_netname : "(null)");
 335                         smb_tracef("srvsvc coni1_nopens=%u",
 336                             cib1->coni1_num_opens);
 337                         smb_tracef("srvsvc coni1_time=%u", cib1->coni1_time);
 338                         smb_tracef("srvsvc coni1_num_users=%u",
 339                             cib1->coni1_num_users);
 340                 }
 341                 break;
 342 
 343         default:
 344                 smb_tracef("srvsvc: unknown level");
 345                 break;
 346         }
 347 
 348         srvsvc_close(&handle);
 349         return (0);
 350 }
 351 
 352 /*






























































 353  * Compare the time here with the remote time on the server
 354  * and report clock skew.
 355  */
 356 void
 357 srvsvc_timecheck(char *server, char *domain)
 358 {
 359         char                    hostname[MAXHOSTNAMELEN];
 360         struct timeval          dc_tv;
 361         struct tm               dc_tm;
 362         struct tm               *tm;
 363         time_t                  tnow;
 364         time_t                  tdiff;
 365         int                     priority;
 366 
 367         if (srvsvc_net_remote_tod(server, domain, &dc_tv, &dc_tm) < 0) {
 368                 syslog(LOG_DEBUG, "srvsvc_net_remote_tod failed");
 369                 return;
 370         }
 371 
 372         tnow = time(NULL);


 508          */
 509         tod = arg.bufptr;
 510 
 511         if (tv) {
 512                 tv->tv_sec = tod->tod_elapsedt;
 513                 tv->tv_usec = tod->tod_msecs;
 514         }
 515 
 516         if (tm) {
 517                 tm->tm_sec = tod->tod_secs;
 518                 tm->tm_min = tod->tod_mins;
 519                 tm->tm_hour = tod->tod_hours;
 520                 tm->tm_mday = tod->tod_day;
 521                 tm->tm_mon = tod->tod_month - 1;
 522                 tm->tm_year = tod->tod_year - 1900;
 523                 tm->tm_wday = tod->tod_weekday;
 524         }
 525 
 526         srvsvc_close(&handle);
 527         return (0);




































 528 }