Skip to content

Commit

Permalink
Merge pull request #6 from ananace/add-update
Browse files Browse the repository at this point in the history
Add method for adcli_enroll_update
  • Loading branch information
martencassel authored Oct 5, 2018
2 parents da8e5d9 + b5669ce commit 74de56a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions ext/radcli/radenroll.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,36 @@ static VALUE radenroll_join (VALUE self) {
return self;
}

/*
* call-seq:
*
* adenroll.update
*
* 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;
}

/*
* call-seq
*
Expand Down Expand Up @@ -270,6 +300,7 @@ void Init_AdEnroll()
rb_define_method (c_adenroll, "set_computer_password", radenroll_set_computer_password, 1);

rb_define_method (c_adenroll, "join", radenroll_join, 0);
rb_define_method (c_adenroll, "update", radenroll_update, 0);
rb_define_method (c_adenroll, "password", radenroll_password, 0);
rb_define_method (c_adenroll, "delete", radenroll_delete, 0);

Expand Down

0 comments on commit 74de56a

Please sign in to comment.