Class: Adcli::AdEnroll
- Inherits:
-
Object
- Object
- Adcli::AdEnroll
- Defined in:
- ext/radcli/radenroll.c
Instance Method Summary collapse
-
#delete ⇒ Object
Deletes a existing computer from the Active Directory domain.
-
#get_computer_name ⇒ Object
Creates and returns the computer name.
-
#get_computer_password ⇒ Object
Gets the computer password.
- #get_host_fqdn ⇒ Object
-
#initialize ⇒ Object
constructor
Creates and returns a new Adcli::AdEnroll object.
-
#join ⇒ Object
Joins a new computer to the Active Directory domain.
-
#password ⇒ Object
call-seq.
-
#set_computer_name('hostname') ⇒ Object
Set the computer name to do the enroll operation on (join or delete).
-
#set_computer_password('computer-password') ⇒ Object
Sets the computer password.
-
#set_domain_ou('OU = Testing,DC=domain,DC=example,DC=com') ⇒ Object
Set the domain organizational unit.
- #set_host_fqdn ⇒ Object
-
#update ⇒ Object
adenroll.update.
Constructor Details
#conn_object=(Adcli) ⇒ Object #Adcli::AdEnroll.new(conn_object) ⇒ Object
Creates and returns a new Adcli::AdEnroll object.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'ext/radcli/radenroll.c', line 32
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;
}
|
Instance Method Details
#delete ⇒ Object
Deletes a existing computer from the Active Directory domain
265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'ext/radcli/radenroll.c', line 265
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 ⇒ Object
Creates and returns the computer name.
78 79 80 81 82 83 84 85 86 87 |
# File 'ext/radcli/radenroll.c', line 78
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 ⇒ Object
Gets the computer password
146 147 148 149 150 151 152 153 154 155 |
# File 'ext/radcli/radenroll.c', line 146
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 ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'ext/radcli/radenroll.c', line 45
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 ⇒ Object
Joins a new computer to the Active Directory domain. Creates a machine account and sets a password for it.
188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'ext/radcli/radenroll.c', line 188
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 ⇒ Object
call-seq
adenroll.password
Updates a computer password
241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'ext/radcli/radenroll.c', line 241
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') ⇒ Object
Set the computer name to do the enroll operation on (join or delete).
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'ext/radcli/radenroll.c', line 97
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') ⇒ Object
Sets the computer password
165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'ext/radcli/radenroll.c', line 165
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') ⇒ Object
Set the domain organizational unit.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'ext/radcli/radenroll.c', line 122
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 ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'ext/radcli/radenroll.c', line 56
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 ⇒ Object
adenroll.update
Updates a computer object
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'ext/radcli/radenroll.c', line 211
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;
}
|