JunkBox_Lib 1.10.1
Loading...
Searching...
No Matches
isnet_server.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int command_HELLO (Buffer operand, Buffer comment, int sock)
 
int command_BYE (Buffer operand, Buffer comment, int sock)
 
int command_USERID (Buffer operand, Buffer comment, int sock)
 
int command_PASSWD (Buffer operand, Buffer comment, int sock)
 
int command_NOCHLNG (Buffer operand, Buffer comment, int sock)
 
int command_KEYEX (Buffer operand, Buffer comment, int sock)
 
int command_CRYPT (Buffer operand, Buffer comment, int sock)
 

Variables

BufferBase64_DHspki
 
BufferBase64_RSAspki
 
EVP_CIPHER * CRYPT_Type
 
BufferCRYPT_SharedKey
 
DH * DHkey
 
BufferUser_ID
 
BufferUser_Passwd
 
BufferUser_Salt
 
int No_isNet_Chlng
 
int Use_isNet_Ldap
 
int Use_isNet_Crypt
 

Function Documentation

◆ command_BYE()

int command_BYE ( Buffer operand,
Buffer comment,
int sock )

int command_BYE(Buffer operand, Buffer comment, int sock)

BYEコマンドを処理する.サーバ側処理.

Parameters
operandコマンドのオペランド
commentコマンドのコメント
sockクライアントへのソケット
Return values
0成功
0以外エラー番号
エラー番号
110 - 119

Definition at line 314 of file isnet_server.c.

315{
316 int cc;
317
318 UNUSED(operand);
319 UNUSED(comment);
320 //
321 cc = tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
322 //clear_CRYPT_parameter();
323 return cc;
324}
#define UNUSED(x)
Definition common.h:264
EVP_CIPHER * CRYPT_Type
Definition isnet_server.c:6
Buffer * CRYPT_SharedKey
Definition isnet_server.c:5
int tcp_send_crypt_mesg(int sock, char *mesg, Buffer *key, EVP_CIPHER *cipher)
Definition ssl_tool.c:298

References CRYPT_SharedKey, CRYPT_Type, tcp_send_crypt_mesg(), and UNUSED.

Here is the call graph for this function:

◆ command_CRYPT()

int command_CRYPT ( Buffer operand,
Buffer comment,
int sock )

int command_CRYPT(Buffer operand, Buffer comment, int sock)

CRYPTコマンドを処理する.サーバ側処理.

暗号化方法を変えた場合は,この関数の終了(OK返答)直後から新しい手法に変わる.

Parameters
operandコマンドのオペランド
commentコマンドのコメント
sockクライアントへのソケット
Return values
0成功
0以外エラー番号
エラー番号
170 - 179

Definition at line 482 of file isnet_server.c.

483{
484 UNUSED(comment);
485
486 if (CRYPT_SharedKey==NULL) {
487 tcp_send_crypt_mesg(sock, (char*)"ERR 171 No Shared Key.\r\n", NULL, NULL);
488 DEBUG_MODE PRINT_MESG("ERR 171 No Shared Key.\n");
489 return 171;
490 }
491
492 if (!strcmp("AES128CBC", (const char*)operand.buf)) { // AES 128bit CBC
493 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
494 free(CRYPT_Type);
495 CRYPT_Type = init_EVPAPI_Buffer(SSL_AES128CBC);
496 }
497 else if (!strcmp("3DES3CBC", (const char*)operand.buf)) { // 3DES 3key CBC
498 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
499 CRYPT_Type = init_EVPAPI_Buffer(SSL_3DES3CBC);
500 }
501 else if (!strcmp("RESET", (const char*)operand.buf)) { // RESET: 暗号化中止
502 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
503 //free_EVPAPI_Buffer();
504 }
505 else {
506 tcp_send_crypt_mesg(sock, (char*)"ERR 179 Unkown CRYPT operand.\r\n", CRYPT_SharedKey, CRYPT_Type);
507 DEBUG_MODE PRINT_MESG("ERR 179 Unkown CRYPT operand.\n");
508 return 179;
509 }
510
511 return 0;
512}
EVP_CIPHER * init_EVPAPI_Buffer(int type)
Definition ssl_tool.c:645
unsigned char * buf
バッファの先頭へのポインタ.str[bufsz]は必ず 0x00となる.
Definition buffer.h:39
#define PRINT_MESG
環境依存用の出力関数.print_message()
Definition tools.h:475
#define DEBUG_MODE
Definition tools.h:502

References Buffer::buf, CRYPT_SharedKey, CRYPT_Type, DEBUG_MODE, init_EVPAPI_Buffer(), PRINT_MESG, tcp_send_crypt_mesg(), and UNUSED.

Here is the call graph for this function:

◆ command_HELLO()

int command_HELLO ( Buffer operand,
Buffer comment,
int sock )

int command_HELLO(Buffer operand, Buffer comment, int sock)

HELLOコマンドを処理する.サーバ側処理.

Parameters
operandコマンドのオペランド
commentコマンドのコメント
sockクライアントへのソケット
Return values
0成功
0以外エラー番号
エラー番号
100 - 109

Definition at line 287 of file isnet_server.c.

288{
289 int cc;
290
291 UNUSED(operand);
292 UNUSED(comment);
293 //
294 cc = tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
295 return cc;
296}

References CRYPT_SharedKey, CRYPT_Type, tcp_send_crypt_mesg(), and UNUSED.

Here is the call graph for this function:

◆ command_KEYEX()

int command_KEYEX ( Buffer operand,
Buffer comment,
int sock )

int command_KEYEX(Buffer operand, Buffer comment, int sock)

KEYEXコマンドを処理する.サーバ側処理.

パスワード(及びその他の情報)の交換方法を指定する. オペランドに公開鍵暗号のアルゴリズムが指定されたときに転送するサーバ側の SPKI は外部で 計算済みでなければならない(主にコマンド起動時).

鍵交換アルゴリズムの指定の後,KEYEX SKPI が正常に処理されると,この関数は共有鍵を生成する. 生成された共有鍵は デフォルト共有鍵となる.

Parameters
operandDH: パスワード情報を暗号化するための,暗号化鍵の交換アルゴリズムとして Diffie-Hellman を指定する.サーバは続いて,自己のSPKIとして Diffie-Hellnan の SPKI(Base64_DHspki) をクラインとに転送する.
operandRSA: 鍵交換アルゴリズムに RSA を設定し,サーバはSPKIとして RSAの SPKI(Base64_RSAspki) をクライアントに転送する.(多分 ssl_tool.c 中でまだ実装されていない)
operandSPKI: クライアントは,続いて自己のSPKIをサーバへ転送する.サーバはそれを受け取り, 直前に指定された鍵交換のアルゴリズムに従って,共有鍵を生成する.
operandCHLNG: パスワードの交換にチャレンジキーを使用する.デフォルト.
operandNOCHLNG: パスワードの交換にチャレンジキーを使用しない.この場合は必ず鍵交換 アルゴリズムを指定して暗号化鍵を交換し,通信を暗号化しなければならない.
commentコマンドのコメント
sockクライアントへのソケット
Return values
0成功
0以外エラー番号
エラー番号
160 - 169
See also
get_CRYPT_SharedKey(), exchange_CRYPT_SharedKey()

Definition at line 360 of file isnet_server.c.

361{
362 static int keyex;
363 Buffer buf;
364
365 UNUSED(comment);
366
367 if (!strcmp("DH", (const char*)operand.buf)) {
368 if (Base64_DHspki!=NULL) {
370 keyex = SSL_DH;
371 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
372
375 cat_s2Buffer("\r\nEND\r\n", &buf);
378 }
379 else {
380 tcp_send_crypt_mesg(sock, (char*)"ERR 161 KEYEX DH Error.\r\n", CRYPT_SharedKey, CRYPT_Type);
381 DEBUG_MODE PRINT_MESG("ERR 161 KEYEX DH Error.\n");
382 return 161;
383 }
384 }
385
386 else if (!strcmp("RSA", (const char*)operand.buf)) {
387 if (Base64_RSAspki!=NULL) {
389 keyex = SSL_RSA;
390
391 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
394 cat_s2Buffer("\r\nEND\r\n", &buf);
397 }
398 else {
399 tcp_send_crypt_mesg(sock, (char*)"ERR 162 KEYEX RSA Error.\r\n", CRYPT_SharedKey, CRYPT_Type);
400 DEBUG_MODE PRINT_MESG("ERR 162 KEYEX RSA Error.\n");
401 return 162;
402 }
403 }
404
405 else if (!strcmp("SPKI", (const char*)operand.buf)) {
406 Buffer dkey;
407
408 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
410 tcp_recv_Buffer_wait(sock, &buf, 20);
413 chomp_Buffer(&dkey);
415 free_Buffer(&dkey);
416
419
420 if (gen_CRYPT_SharedKey(keyex, buf, CRYPT_SharedKey, (void*)DHkey)) {
421 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
422 }
423 else {
424 tcp_send_crypt_mesg(sock, (char*)"ERR 163 cannot generate Shared KEY.\r\n", CRYPT_SharedKey, CRYPT_Type);
425 DEBUG_MODE PRINT_MESG("ERR 163 cannot generate Shared KEY.\n");
426 return 163;
427 }
429 }
430
431 else if (!strcmp("CHLNG", (const char*)operand.buf)) {
432 if (!Use_isNet_Ldap) {
434 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
435 }
436 else {
437 tcp_send_crypt_mesg(sock, (char*)"ERR 164 cannot use Challenge Key mode with LDAP mode.\r\n", CRYPT_SharedKey, CRYPT_Type);
438 DEBUG_MODE PRINT_MESG("ERR 164 cannot use Challenge Key mode with LDAP mode.\n");
439 return 164;
440 }
441 }
442
443 else if (!strcmp("NOCHLNG", (const char*)operand.buf)) {
444 if (Use_isNet_Crypt==TRUE) {
446 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
447 }
448 else {
449 tcp_send_crypt_mesg(sock, (char*)"ERR 165 both No Challenge Key mode and No Crypt mode are not used.\r\n", CRYPT_SharedKey, CRYPT_Type);
450 DEBUG_MODE PRINT_MESG("ERR 165 both No Challenge Key mode and No Crypt mode are not used.\n");
451 return 165;
452 }
453 }
454
455 else {
456 tcp_send_crypt_mesg(sock, (char*)"ERR 169 Unkown KEYEX operand.\n\r", CRYPT_SharedKey, CRYPT_Type);
457 DEBUG_MODE PRINT_MESG("ERR 169 Unkown KEYEX operand.\r");
458 return 169;
459 }
460
461 return 0;
462}
Buffer make_Buffer(int sz)
Buffer型変数のバッファ部をつくり出す.
Definition buffer.c:71
void chomp_Buffer(Buffer *str)
最初の改行コード以降を無視する.
Definition buffer.c:1347
void free_Buffer(Buffer *buf)
Buffer型変数のバッファ部を解放する
Definition buffer.c:128
Buffer decode_base64_Buffer(Buffer str)
strのバッファを Base64からデコードする
Definition buffer.c:850
Buffer * new_Buffer(int sz)
空のBuffer型変数を生成する.
Definition buffer.c:23
int copy_Buffer(Buffer *src, Buffer *dst)
Buffer型変数 srcから dstへバッファをコピーする.
Definition buffer.c:315
#define cat_s2Buffer(src, dst)
cat_b2Buffer()
Definition buffer.h:122
#define LBUF
Definition common.h:146
#define TRUE
Definition common.h:226
#define FALSE
Definition common.h:223
Buffer * Base64_DHspki
Definition isnet_server.c:2
int Use_isNet_Ldap
DH * DHkey
Definition isnet_server.c:7
int No_isNet_Chlng
int Use_isNet_Crypt
Buffer * Base64_RSAspki
Definition isnet_server.c:3
unsigned char ** buf
Definition jpeg_tool.h:96
int tcp_send_crypt_sBuffer(int sock, Buffer *mesg, Buffer *key, EVP_CIPHER *cipher)
Definition ssl_tool.c:351
int gen_CRYPT_SharedKey(int keyex, Buffer spki, Buffer *shdkey, void *ptr)
Definition ssl_tool.c:91
Buffer get_plain_sBuffer(Buffer mesg, Buffer *key, EVP_CIPHER *cipher)
Definition ssl_tool.c:423
int tcp_recv_Buffer_wait(int sock, Buffer *str, int tm)
TCP経由でデータを受信する.待ち時間(タイムアウト)を指定できる.
Definition xtools.c:370

References Base64_DHspki, Base64_RSAspki, buf, Buffer::buf, cat_s2Buffer, chomp_Buffer(), copy_Buffer(), CRYPT_SharedKey, CRYPT_Type, DEBUG_MODE, decode_base64_Buffer(), DHkey, FALSE, free_Buffer(), gen_CRYPT_SharedKey(), get_plain_sBuffer(), LBUF, make_Buffer(), new_Buffer(), No_isNet_Chlng, PRINT_MESG, tcp_recv_Buffer_wait(), tcp_send_crypt_mesg(), tcp_send_crypt_sBuffer(), TRUE, UNUSED, Use_isNet_Crypt, and Use_isNet_Ldap.

Here is the call graph for this function:

◆ command_NOCHLNG()

int command_NOCHLNG ( Buffer operand,
Buffer comment,
int sock )

◆ command_PASSWD()

int command_PASSWD ( Buffer operand,
Buffer comment,
int sock )

int command_PASSWD(Buffer operand, Buffer comment, int sock)

PASSWDコマンドを処理する.サーバ側処理.

Parameters
operandコマンドのオペランド
commentコマンドのコメント
sockクライアントへのソケット
Return values
0成功
0以外エラー番号
エラー番号
130 - 139

Definition at line 187 of file isnet_server.c.

188{
189 char* opass = NULL; // Password that from system
190 char* npass = NULL; // Password that crypted opass
191 char* salt = NULL;
192
193 UNUSED(comment);
194
195 if (User_Passwd==NULL) {
196 tcp_send_crypt_mesg(sock, (char*)"ERR 131 system has not a your password.\r\n", CRYPT_SharedKey, CRYPT_Type);
197 DEBUG_MODE PRINT_MESG("ERR 131 system has not a your password.\n");
198 return 131;
199 }
200
201#ifdef ENABLE_LDAP
202 int cc;
203 if (!strcmp((const char*)User_Passwd->buf, "*") && Use_isNet_Ldap) {
208 cc = simple_check_ldap_passwd(ld, (char*)User_ID->buf, (char*)operand.buf, LdapBind);
210 //
211 if (cc==0) {
212 cc = tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
213 return 0;
214 }
215 else {
216 cc = tcp_send_crypt_mesg(sock, (char*)"ERR 138 PASSWD error.\r\n", CRYPT_SharedKey, CRYPT_Type);
217 DEBUG_MODE PRINT_MESG("ERR 138 PASSWD error.\n");
218 return 138;
219 }
220 }
221#endif
222
223 int lsalt = 0;
224 if (User_Passwd->buf[0]=='$') {
225 if (User_Passwd->buf[1]=='1') lsalt = LEN_DOLLAR_SALT;
226 //else if (User_Passwd->buf[1]=='2') lsalt = LEN_DOLLAR2_SALT;
227 else if (User_Passwd->buf[1]=='5') lsalt = LEN_DOLLAR5_SALT;
228 else if (User_Passwd->buf[1]=='6') lsalt = LEN_DOLLAR6_SALT;
229
230 opass = (char*)&(User_Passwd->buf[lsalt]);
231 }
232 else if (strlen((const char*)User_Passwd->buf)==LEN_DESPASS) {
233 lsalt = 2;
234 opass = (char*)&(User_Passwd->buf[lsalt]);
235 }
236
237 //
238 if (No_isNet_Chlng==FALSE) { // Use Challenge Keys
239 salt = get_line((char*)User_Salt->buf, 2);
240 if (salt!=NULL && opass!=NULL) {
241 npass = (char*)crypt((const char*)opass, (const char*)salt);
242 npass = &(npass[lsalt]);
243 }
244 if (npass!=NULL) {
245 if (!strcmp((const char*)operand.buf, (const char*)npass)) {
246 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
247 return 0;
248 }
249 }
250 }
251 else { // Not Use Challenge Keys
252 salt = get_line((char*)User_Salt->buf, 1);
253 if (salt!=NULL && operand.buf!=NULL) {
254 npass = (char*)crypt((const char*)operand.buf, (const char*)salt);
255 npass = &(npass[lsalt]);
256 free(salt);
257 }
258 if (npass!=NULL && opass!=NULL) {
259 if (!strcmp((const char*)opass, (const char*)npass)) {
260 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
261 return 0;
262 }
263 }
264 }
265
266 tcp_send_crypt_mesg(sock, (char*)"ERR 139 PASSWD error.\r\n", CRYPT_SharedKey, CRYPT_Type);
267 DEBUG_MODE PRINT_MESG("ERR 139 PASSWD error.\n");
268 return 139;
269}
Buffer * User_ID
Definition isnet_server.c:9
JBXL_LDAP_Host * LdapHost
JBXL_LDAP_Dn * LdapBind
Buffer * User_Passwd
Buffer * User_Salt
void close_ldap_connection(LDAP *ld, JBXL_LDAP_Host **p_ldap_host, JBXL_LDAP_Dn **p_ldap_bind)
Definition ldap_tool.c:367
LDAP * open_ldap_connection(JBXL_LDAP_Host *ldap_host, JBXL_LDAP_Dn *ldap_bind)
Definition ldap_tool.c:129
JBXL_LDAP_Host * new_LDAP_Host(void)
Definition ldap_tool.c:418
JBXL_LDAP_Dn * new_LDAP_Dn(void)
Definition ldap_tool.c:428
int simple_check_ldap_passwd(LDAP *ld, char *userid, char *passwd, JBXL_LDAP_Dn *ldap_bind)
Definition ldap_tool.c:230
void read_ldap_config(char *fn, JBXL_LDAP_Host *ldap_host, JBXL_LDAP_Dn *ldap_bind)
Definition ldap_tool.c:37
#define LEN_DOLLAR5_SALT
Definition password.h:46
#define LEN_DOLLAR_SALT
Definition password.h:44
#define LEN_DESPASS
Definition password.h:51
#define LEN_DOLLAR6_SALT
Definition password.h:47
char * get_line(char *buf, int n)
文字型データbufのバッファ内の n行目を取り出す.改行コードは削除される.要 free()
Definition tools.c:484

References Buffer::buf, close_ldap_connection(), CRYPT_SharedKey, CRYPT_Type, DEBUG_MODE, FALSE, get_line(), LdapBind, LdapHost, LEN_DESPASS, LEN_DOLLAR5_SALT, LEN_DOLLAR6_SALT, LEN_DOLLAR_SALT, new_LDAP_Dn(), new_LDAP_Host(), No_isNet_Chlng, open_ldap_connection(), PRINT_MESG, read_ldap_config(), simple_check_ldap_passwd(), tcp_send_crypt_mesg(), UNUSED, Use_isNet_Ldap, User_ID, User_Passwd, and User_Salt.

Here is the call graph for this function:

◆ command_USERID()

int command_USERID ( Buffer operand,
Buffer comment,
int sock )

int command_USERID(Buffer operand, Buffer comment, int sock)

USERIDコマンドを処理する.サーバ側処理.

チャレンジコードを要求しない場合,パスワードが生で流れる可能性があるので,必ず暗号化すること.

Parameters
operandコマンドのオペランド
commentコマンドのコメント
sockクライアントへのソケット
Return values
0成功
0以外エラー番号
エラー番号
120 - 129

Definition at line 45 of file isnet_server.c.

46{
47 char* pass = NULL;
48 char* salt0 = NULL;
49 char* salt1 = NULL;
50 char* salt2 = NULL;
51 Buffer buf;
52
53 UNUSED(comment);
54
55 pass = get_passwd((char*)operand.buf);
56 if (pass==NULL) {
57 tcp_send_crypt_mesg(sock, (char*)"ERR 121 passwd get error.\r\n", CRYPT_SharedKey, CRYPT_Type);
58 DEBUG_MODE PRINT_MESG("ERR 121 passwd get error.\n");
59 return 121;
60 }
61
63 tcp_send_crypt_mesg(sock, (char*)"ERR 122 both No Challenge Key mode and No Crypt mode are not used.\r\n", CRYPT_SharedKey, CRYPT_Type);
64 DEBUG_MODE PRINT_MESG("ERR 122 both No Challenge Key mode and No Crypt mode are not used.\n");
65 return 122;
66 }
67
69 tcp_send_crypt_mesg(sock, (char*)"ERR 123 both Challenge Key mode and Ldap mode are not used.\r\n", CRYPT_SharedKey, CRYPT_Type);
70 DEBUG_MODE PRINT_MESG("ERR 123 both Challenge Key mode and Ldap mode are not used.\n");
71 return 123;
72 }
73
74 if (User_ID!=NULL) del_Buffer(&User_ID);
76 if (User_Salt!=NULL) del_Buffer(&User_Salt);
80 *User_ID = dup_Buffer(operand);
82
83 //
84 if (strlen(pass)<=2) {
85#ifdef ENABLE_LDAP
86 int cc;
87 if (!strcmp((const char*)User_Passwd->buf, "*") && Use_isNet_Ldap) {
92 //
93 if (ld!=NULL) {
94 cc = simple_check_ldap_passwd(ld, (char*)User_ID->buf, NULL, LdapBind);
96 if (cc==JBXL_LDAP_PASSWD_ERROR) {
97 cc = tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
98 return 0;
99 }
100 else {
101 cc = tcp_send_crypt_mesg(sock, (char*)"ERR 128 USERID error with LDAP.\r\n", CRYPT_SharedKey, CRYPT_Type);
102 DEBUG_MODE PRINT_MESG("ERR 128 USERID error with LDAP.\n");
103 return 128;
104 }
105 }
106 else {
107 cc = tcp_send_crypt_mesg(sock, (char*)"ERR 127 USERID connection error with LDAP.\r\n", CRYPT_SharedKey, CRYPT_Type);
108 DEBUG_MODE PRINT_MESG("ERR 127 USERID connection error with LDAP.\n");
109 return 127;
110 }
111 }
112#endif
113 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
114 return 0;
115 }
116
117 //
118 if (pass[0]=='$') {
119 int lsalt = 0;
120 if (pass[1]=='1') lsalt = LEN_DOLLAR_SALT;
121 //else if (pass[1]=='2') lsalt = LEN_DOLLAR2_SALT; // Blowfish 未対応
122 else if (pass[1]=='5') lsalt = LEN_DOLLAR5_SALT;
123 else if (pass[1]=='6') lsalt = LEN_DOLLAR6_SALT;
124
125 if (lsalt!=0) {
126 *User_Salt = make_Buffer(lsalt*2 + 5); // \r\n \r\n \0 で +5文字
127 salt0 = cut_str(pass, 0, 2);
128 salt1 = cut_str(pass, 0, lsalt-1);
129 salt2 = randstr(lsalt-4);
130 copy_s2Buffer(salt1, User_Salt);
131 cat_s2Buffer("\r\n", User_Salt);
132 cat_s2Buffer(salt0, User_Salt);
133 cat_s2Buffer(salt2, User_Salt);
135 }
136 }
137 // DES
138 else if (strlen((const char*)pass)==LEN_DESPASS) {
140 salt1 = cut_str(pass, 0, LEN_DESSALT-1);
141 salt2 = randstr(LEN_DESSALT);
142 copy_s2Buffer(salt1, User_Salt);
143 cat_s2Buffer ("\r\n", User_Salt);
144 cat_s2Buffer (salt2, User_Salt);
145 }
146
147 freeNull(pass);
148 freeNull(salt0);
149 freeNull(salt1);
150 freeNull(salt2);
151
152 if (User_Salt->buf!=NULL) {
153 tcp_send_crypt_mesg(sock, (char*)"OK\r\n", CRYPT_SharedKey, CRYPT_Type);
154 if (No_isNet_Chlng==FALSE) {
157 cat_s2Buffer("\r\nEND\r\n", &buf);
160 }
161 }
162 else {
163 tcp_send_crypt_mesg(sock, (char*)"ERR 129 USERID error.\r\n", CRYPT_SharedKey, CRYPT_Type);
164 DEBUG_MODE PRINT_MESG("ERR 129 USERID error.\n");
165 return 129;
166 }
167
168 return 0;
169}
Buffer dup_Buffer(Buffer buf)
Buffer型変数のコピーをつくる.
Definition buffer.c:211
void del_Buffer(Buffer **buf)
new_Buffer()で作り出した Buffer型変数を削除する.
Definition buffer.c:148
#define copy_s2Buffer(src, dst)
copy_b2Buffer()
Definition buffer.h:108
#define make_Buffer_bystr(str)
set_Buffer()
Definition buffer.h:57
#define JBXL_LDAP_PASSWD_ERROR
ユーザ認証失敗(ユーザは存在するが,パスワードが一致しない)
Definition jbxl_state.h:138
char * get_passwd(char *user_id)
Definition password.c:25
#define LEN_DESSALT
Definition password.h:52
char * randstr(int n)
ランダムに A-Za-z0-9 までの文字を n文字生成する.
Definition tools.c:1777
char * cut_str(char *buf, int ls, int le)
buf[ls]〜buf[le] を切り出す.要 free()
Definition tools.c:1338
#define freeNull(p)
Definition tools.h:201

References buf, Buffer::buf, cat_s2Buffer, close_ldap_connection(), copy_Buffer(), copy_s2Buffer, CRYPT_SharedKey, CRYPT_Type, cut_str(), DEBUG_MODE, del_Buffer(), dup_Buffer(), FALSE, free_Buffer(), freeNull, get_passwd(), JBXL_LDAP_PASSWD_ERROR, LBUF, LdapBind, LdapHost, LEN_DESPASS, LEN_DESSALT, LEN_DOLLAR5_SALT, LEN_DOLLAR6_SALT, LEN_DOLLAR_SALT, make_Buffer(), make_Buffer_bystr, new_Buffer(), new_LDAP_Dn(), new_LDAP_Host(), No_isNet_Chlng, open_ldap_connection(), PRINT_MESG, randstr(), read_ldap_config(), simple_check_ldap_passwd(), tcp_send_crypt_mesg(), tcp_send_crypt_sBuffer(), TRUE, UNUSED, Use_isNet_Crypt, Use_isNet_Ldap, User_ID, User_Passwd, and User_Salt.

Here is the call graph for this function:

Variable Documentation

◆ Base64_DHspki

Buffer* Base64_DHspki
extern

Definition at line 2 of file isnet_server.c.

Referenced by command_KEYEX().

◆ Base64_RSAspki

Buffer* Base64_RSAspki
extern

Definition at line 3 of file isnet_server.c.

Referenced by command_KEYEX().

◆ CRYPT_SharedKey

Buffer* CRYPT_SharedKey
extern

◆ CRYPT_Type

EVP_CIPHER* CRYPT_Type
extern

◆ DHkey

DH* DHkey
extern

Definition at line 7 of file isnet_server.c.

Referenced by command_KEYEX().

◆ No_isNet_Chlng

int No_isNet_Chlng
extern

Definition at line 13 of file isnet_server.c.

Referenced by command_KEYEX(), command_PASSWD(), and command_USERID().

◆ Use_isNet_Crypt

int Use_isNet_Crypt
extern

Definition at line 15 of file isnet_server.c.

Referenced by command_KEYEX(), and command_USERID().

◆ Use_isNet_Ldap

int Use_isNet_Ldap
extern

Definition at line 14 of file isnet_server.c.

Referenced by command_KEYEX(), command_PASSWD(), and command_USERID().

◆ User_ID

Buffer* User_ID
extern

Definition at line 9 of file isnet_server.c.

Referenced by command_PASSWD(), and command_USERID().

◆ User_Passwd

Buffer* User_Passwd
extern

Definition at line 10 of file isnet_server.c.

Referenced by command_PASSWD(), and command_USERID().

◆ User_Salt

Buffer* User_Salt
extern

Definition at line 11 of file isnet_server.c.

Referenced by command_PASSWD(), and command_USERID().