class Adcli::AdEnroll
Public Class Methods
conn_object = Adcli::AdConn.connect('YOUR.REALM.COM')
click to toggle source
Adcli::AdEnroll.new(conn_object)
Creates and returns a new Adcli::AdEnroll
object.
static VALUE radenroll_initialize (VALUE self, VALUE ad_conn) { RUBY_ADCONN *ptr_conn; RUBY_ADENROLL *ptr_enroll; Data_Get_Struct (ad_conn, RUBY_ADCONN, ptr_conn); Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); adcli_enroll *enroll = adcli_enroll_new (ptr_conn->conn); ptr_enroll->enroll = enroll; return self; }
Public Instance Methods
delete
click to toggle source
Deletes a existing computer from the Active Directory domain
static VALUE radenroll_delete (VALUE self) { RUBY_ADENROLL *ptr_enroll; adcli_result result;; Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); result = adcli_enroll_delete (ptr_enroll->enroll, 0); if (result != ADCLI_SUCCESS) { rb_raise(rb_eRuntimeError, "%s", adcli_get_last_error()); } return self; }
get_computer_name # → hostname.your.realm.com
click to toggle source
Creates and returns the computer name.
static VALUE radenroll_get_computer_name (VALUE self) { RUBY_ADENROLL *ptr_enroll; const char *c_computer_name = NULL; Data_Get_Struct (self ,RUBY_ADENROLL, ptr_enroll); c_computer_name = adcli_enroll_get_computer_name (ptr_enroll->enroll); return rb_str_new_cstr (c_computer_name); }
get_computer_password
click to toggle source
Gets the computer password
static VALUE radenroll_get_computer_password (VALUE self) { RUBY_ADENROLL *ptr_enroll; const char *c_computer_password = NULL; Data_Get_Struct (self ,RUBY_ADENROLL, ptr_enroll); c_computer_password = adcli_enroll_get_computer_password (ptr_enroll->enroll); return rb_str_new_cstr (c_computer_password); }
get_host_fqdn()
click to toggle source
static VALUE radenroll_get_host_fqdn (VALUE self) { RUBY_ADENROLL *ptr_enroll; const char *c_host_fqdn = NULL; Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); c_host_fqdn = adcli_enroll_get_host_fqdn(ptr_enroll->enroll); return rb_str_new_cstr (c_host_fqdn); }
join
click to toggle source
Joins a new computer to the Active Directory domain. Creates a machine account and sets a password for it.
static VALUE radenroll_join (VALUE self) { RUBY_ADENROLL *ptr_enroll; adcli_result result; Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); result = adcli_enroll_join (ptr_enroll->enroll, ADCLI_ENROLL_NO_KEYTAB); if(result != ADCLI_SUCCESS) { rb_raise(rb_eRuntimeError, "%s", adcli_get_last_error()); } return self; }
password()
click to toggle source
call-seq
adenroll.password
Updates a computer password
static VALUE radenroll_password (VALUE self) { RUBY_ADENROLL *ptr_enroll; adcli_result result; Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); result = adcli_enroll_password (ptr_enroll->enroll, ADCLI_ENROLL_PASSWORD_VALID); if (result != ADCLI_SUCCESS) { rb_raise(rb_eRuntimeError, "%s", adcli_get_last_error()); } return self; }
set_computer_name('hostname')
click to toggle source
Set the computer name to do the enroll operation on (join or delete).
static VALUE radenroll_set_computer_name (VALUE self, VALUE value) { RUBY_ADENROLL *ptr_enroll; adcli_enroll *enroll; Check_Type(value, T_STRING); const char *c_value = StringValuePtr (value); Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); enroll = ptr_enroll->enroll; adcli_enroll_set_computer_name (enroll, c_value); return self; }
set_computer_password('computer-password')
click to toggle source
Sets the computer password
static VALUE radenroll_set_computer_password (VALUE self, VALUE value) { RUBY_ADENROLL *ptr_enroll; Check_Type(value, T_STRING); adcli_enroll *enroll; Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); enroll = ptr_enroll->enroll; const char *c_value = StringValuePtr (value); adcli_enroll_set_computer_password (enroll, c_value); return self; }
set_domain_ou('OU=Testing,DC=domain,DC=example,DC=com')
click to toggle source
Set the domain organizational unit.
static VALUE radenroll_set_domain_ou (VALUE self, VALUE value) { RUBY_ADENROLL *ptr_enroll; adcli_enroll *enroll; Check_Type(value, T_STRING); Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); const char *c_value = StringValuePtr(value); enroll = ptr_enroll->enroll; adcli_enroll_set_domain_ou(enroll, c_value); return self; }
set_host_fqdn(p1)
click to toggle source
static VALUE radenroll_set_host_fqdn (VALUE self, VALUE value) { RUBY_ADENROLL *ptr_enroll; adcli_enroll *enroll; Check_Type(value, T_STRING); const char *c_fqdn = StringValuePtr (value); Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); enroll = ptr_enroll->enroll; adcli_enroll_set_host_fqdn (enroll, c_fqdn); return self; }
update
click to toggle source
Updates a computer object
static VALUE radenroll_update (VALUE self) { RUBY_ADENROLL *ptr_enroll; adcli_result result; const char* c_computer_password = NULL; adcli_enroll_flags flags = ADCLI_ENROLL_NO_KEYTAB; Data_Get_Struct (self, RUBY_ADENROLL, ptr_enroll); c_computer_password = adcli_enroll_get_computer_password (ptr_enroll->enroll); if (c_computer_password != NULL) { flags |= ADCLI_ENROLL_PASSWORD_VALID; } result = adcli_enroll_update (ptr_enroll->enroll, flags); if(result != ADCLI_SUCCESS) { rb_raise(rb_eRuntimeError, "%s", adcli_get_last_error()); } return self; }