408 */
409 if (smb_gethostname(old_pw, sizeof (old_pw), SMB_CASE_LOWER) != 0)
410 return (NT_STATUS_INTERNAL_ERROR);
411 old_pw[14] = '\0';
412
413 status = netr_change_password(dxi->d_dci.dc_name, machine_name,
414 old_pw, machine_pw);
415 if (status != NT_STATUS_SUCCESS) {
416 syslog(LOG_NOTICE,
417 "Change machine account password: %s",
418 xlate_nt_status(status));
419 }
420 return (status);
421 }
422
423 void
424 mlsvc_disconnect(const char *server)
425 {
426 smbrdr_disconnect(server);
427 }
|
408 */
409 if (smb_gethostname(old_pw, sizeof (old_pw), SMB_CASE_LOWER) != 0)
410 return (NT_STATUS_INTERNAL_ERROR);
411 old_pw[14] = '\0';
412
413 status = netr_change_password(dxi->d_dci.dc_name, machine_name,
414 old_pw, machine_pw);
415 if (status != NT_STATUS_SUCCESS) {
416 syslog(LOG_NOTICE,
417 "Change machine account password: %s",
418 xlate_nt_status(status));
419 }
420 return (status);
421 }
422
423 void
424 mlsvc_disconnect(const char *server)
425 {
426 smbrdr_disconnect(server);
427 }
428
429 /*
430 * A few more helper functions for RPC services.
431 */
432
433 /*
434 * Check whether or not the specified user has administrator privileges,
435 * i.e. is a member of Domain Admins or Administrators.
436 * Returns true if the user is an administrator, otherwise returns false.
437 */
438 boolean_t
439 ndr_is_admin(ndr_xa_t *xa)
440 {
441 smb_netuserinfo_t *ctx = xa->pipe->np_user;
442
443 return (ctx->ui_flags & SMB_ATF_ADMIN);
444 }
445
446 /*
447 * Check whether or not the specified user has power-user privileges,
448 * i.e. is a member of Domain Admins, Administrators or Power Users.
449 * This is typically required for operations such as managing shares.
450 * Returns true if the user is a power user, otherwise returns false.
451 */
452 boolean_t
453 ndr_is_poweruser(ndr_xa_t *xa)
454 {
455 smb_netuserinfo_t *ctx = xa->pipe->np_user;
456
457 return ((ctx->ui_flags & SMB_ATF_ADMIN) ||
458 (ctx->ui_flags & SMB_ATF_POWERUSER));
459 }
460
461 int32_t
462 ndr_native_os(ndr_xa_t *xa)
463 {
464 smb_netuserinfo_t *ctx = xa->pipe->np_user;
465
466 return (ctx->ui_native_os);
467 }
|