Class: Adcli::AdConn

Inherits:
Object
  • Object
show all
Defined in:
ext/radcli/radconn.c

Instance Method Summary collapse

Constructor Details

#Adcli::Adconn.new("domain.com") ⇒ Object

Creates and returns a new Adcli::Adconn object.



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'ext/radcli/radconn.c', line 31

static VALUE radconn_initialize (VALUE self, VALUE domain) {
    RUBY_ADCONN* ptr;

    Check_Type(domain, T_STRING);
    
    const char *domain_name = StringValuePtr(domain);

    Data_Get_Struct (self, RUBY_ADCONN, ptr);
    
    ptr->conn = adcli_conn_new (domain_name);

    return self;
}

Instance Method Details

#Adcli::Adconn.connectObject

Connect to Active Directory and authenticate using the login username and password.



248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'ext/radcli/radconn.c', line 248

static VALUE radconn_connect (VALUE self) {
    RUBY_ADCONN* ptr;
    adcli_result result;

    Data_Get_Struct (self ,RUBY_ADCONN, ptr);

    result = adcli_conn_connect (ptr->conn);

    if (result != ADCLI_SUCCESS) {
        rb_raise(c_adconn_exception, "%s", adcli_get_last_error());
    }

    return self;
}

#Adcli::Adconn.get_domain_controller(# = > 'YOUR.DC.REALM.COM') ⇒ Object

Get the domain controller to use.



209
210
211
212
213
214
215
216
217
218
# File 'ext/radcli/radconn.c', line 209

static VALUE radconn_get_domain_controller (VALUE self) {
    RUBY_ADCONN* ptr;
    const char *domain_controller = NULL;

    Data_Get_Struct (self ,RUBY_ADCONN, ptr);

    domain_controller = adcli_conn_get_domain_controller (ptr->conn);

    return rb_str_new_cstr (domain_controller);
}

#Adcli::Adconn.get_domain_realm(#) ⇒ Object

Gets the domain realm.



169
170
171
172
173
174
175
176
177
178
# File 'ext/radcli/radconn.c', line 169

static VALUE radconn_get_domain_realm (VALUE self) {
    RUBY_ADCONN* ptr;
    const char *domain_realm = NULL;

    Data_Get_Struct (self ,RUBY_ADCONN, ptr);

    domain_realm  = adcli_conn_get_domain_realm(ptr->conn);

    return rb_str_new_cstr (domain_realm);
}

#Adcli::Adconn.get_login_ccache_nameObject

Get the login kerberos cache name



73
74
75
76
77
78
79
80
81
82
# File 'ext/radcli/radconn.c', line 73

static VALUE radconn_get_login_ccache_name (VALUE self) {
    RUBY_ADCONN* ptr;
    const char *login_ccache = NULL;

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    login_ccache = adcli_conn_get_login_ccache_name (ptr->conn); 

    return rb_str_new_cstr (login_ccache);
}

#Adcli::Adconn.get_login_user(#) ⇒ Object

Get the login user for authentication.



112
113
114
115
116
117
118
119
120
121
# File 'ext/radcli/radconn.c', line 112

static VALUE radconn_get_login_user (VALUE self) {
    RUBY_ADCONN* ptr;
    const char *login_user = NULL;

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    login_user = adcli_conn_get_login_user (ptr->conn);
    
    return rb_str_new_cstr (login_user);
}

#Adcli::Adconn.get_user_passwordObject

Gets the login user password for authentication.



151
152
153
154
155
156
157
158
159
160
# File 'ext/radcli/radconn.c', line 151

static VALUE radconn_get_user_password (VALUE self) {
    RUBY_ADCONN* ptr;
    const char *login_password = NULL;

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    login_password = adcli_conn_get_user_password(ptr->conn);

    return rb_str_new_cstr(login_password);
}

#Adcli::Adconn.set_domain_controller('YOUR.DC.REALM.COM') ⇒ Object

Get the domain controller to use.



227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'ext/radcli/radconn.c', line 227

static VALUE radconn_set_domain_controller (VALUE self, VALUE domain_controller) {
    RUBY_ADCONN* ptr;
    
    Check_Type(domain_controller, T_STRING);

    char *c_domain_controller = StringValuePtr (domain_controller);

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    adcli_conn_set_domain_controller (ptr->conn, c_domain_controller);

    return self;
}

#Adcli::Adconn.set_domain_realm('YOUR.REALM.COM') ⇒ Object

Set the domain realm.



187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'ext/radcli/radconn.c', line 187

static VALUE radconn_set_domain_realm (VALUE self, VALUE domain_realm) {
    RUBY_ADCONN* ptr;

    Check_Type(domain_realm, T_STRING);

    char *c_domain_realm = StringValuePtr(domain_realm);

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    adcli_conn_set_domain_realm (ptr->conn, c_domain_realm);

    return self;
}

#Adcli::Adconn.set_login_ccache_name("") ⇒ Object

Set the login kerberos cache name



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'ext/radcli/radconn.c', line 52

static VALUE radconn_set_login_ccache_name (VALUE self, VALUE ccname) {
    RUBY_ADCONN* ptr;

    Check_Type(ccname, T_STRING);

    const char *c_ccname = StringValuePtr(ccname);

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    adcli_conn_set_login_ccache_name (ptr->conn, c_ccname);

    return self;
}

#Adcli::Adconn.set_login_user("user") ⇒ Object

Sets the login user that we should authenticate as.



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'ext/radcli/radconn.c', line 91

static VALUE radconn_set_login_user (VALUE self, VALUE user) {
    RUBY_ADCONN* ptr;

    Check_Type(user, T_STRING);

    const char *c_user = StringValuePtr(user);

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    adcli_conn_set_login_user (ptr->conn, c_user);

    return self;
}

#Adcli::Adconn.set_user_passwordObject

Sets the login user password for authentication.



130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'ext/radcli/radconn.c', line 130

static VALUE radconn_set_user_password (VALUE self, VALUE password) {
    RUBY_ADCONN* ptr;

    Check_Type(password, T_STRING);

    const char *c_password = StringValuePtr(password);

    Data_Get_Struct (self, RUBY_ADCONN, ptr);

    adcli_conn_set_user_password (ptr->conn, c_password);

    return self;
}