diff options
| author | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2012-08-11 03:05:26 +0000 |
|---|---|---|
| committer | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2012-08-11 03:05:26 +0000 |
| commit | 9dc4d874c743def8c77af20ecc060e74c3009ca4 (patch) | |
| tree | 989a0f7b6676a36def50ff1c80a8d9064b841b40 | |
| parent | cc2105b2b261f557838fec640d201d93f4c89665 (diff) | |
| download | pica-pica-9dc4d874c743def8c77af20ecc060e74c3009ca4.tar.gz pica-pica-9dc4d874c743def8c77af20ecc060e74c3009ca4.zip | |
client certificate with user id == 0 is considered invalid from now, for error detection purposes (like a NULL pointer)
git-svn-id: svn://localhost/project_picapica/trunk@159 fb96df88-216d-11de-830c-f3023f12d8ac
| -rwxr-xr-x | PICA_node.c | 6 | ||||
| -rwxr-xr-x | doc/TASKS.txt | 2 | ||||
| -rw-r--r-- | pica-client/accountswindow.cpp | 11 | ||||
| -rw-r--r-- | pica-registrar/PICA_registrar.cpp | 2 |
4 files changed, 15 insertions, 6 deletions
diff --git a/PICA_node.c b/PICA_node.c index 27b7e40..97d1fe2 100755 --- a/PICA_node.c +++ b/PICA_node.c @@ -2049,7 +2049,7 @@ while(i_ptr) X509* client_cert; char* DN_str; - printf("SSL connection using %s\n", SSL_get_cipher(i_ptr->ssl_comm));//debug + PICA_info("SSL c2n connection established using %s cipher", SSL_get_cipher(i_ptr->ssl_comm)); client_cert=SSL_get_peer_certificate (i_ptr->ssl_comm); if (!client_cert) @@ -2065,9 +2065,9 @@ while(i_ptr) kill_ptr=i_ptr; } ret=get_id_fromsubjstr(DN_str,&i_ptr->id); - if (!ret) + if (!ret || i_ptr-id == 0) { - //ERR_CHECK //ошибка выделения id + PICA_error("Unable to get client id from certificate, or certificate is invalid"); kill_ptr=i_ptr; } printf("user id=%u\n",i_ptr->id);//debug diff --git a/doc/TASKS.txt b/doc/TASKS.txt index 68a722e..89908c9 100755 --- a/doc/TASKS.txt +++ b/doc/TASKS.txt @@ -47,7 +47,7 @@ + хранение списка узлов pica-node в базе sqlite -- autotools ++ autotools - хранение недоставленных сообщений на стороне клиента, в базе sqlite, пока абонент не появится в сети diff --git a/pica-client/accountswindow.cpp b/pica-client/accountswindow.cpp index b38b5c0..4ad1c75 100644 --- a/pica-client/accountswindow.cpp +++ b/pica-client/accountswindow.cpp @@ -109,8 +109,17 @@ void AccountsWindow::login_click() void AccountsWindow::CreateAccount(QString CertFilename, QString PkeyFilename, bool copyfiles) { quint32 id; + int ret; - PICA_get_id_from_cert(CertFilename.toUtf8().constData(),&id); + ret = PICA_get_id_from_cert(CertFilename.toUtf8().constData(),&id); + + if (0 == id || 0 == ret) + { + QMessageBox mbx; + mbx.setText("Invalid certificate"); + mbx.exec(); + return; + } QString name = OpenSSLTool::NameFromCertFile(CertFilename); diff --git a/pica-registrar/PICA_registrar.cpp b/pica-registrar/PICA_registrar.cpp index 885964e..5b191b4 100644 --- a/pica-registrar/PICA_registrar.cpp +++ b/pica-registrar/PICA_registrar.cpp @@ -404,7 +404,7 @@ while (1) std::string cert_filename = (string)(current_id_str) + ".pem"; - std::string sign_command = (string)"openssl ca -config /home/root_jr/temp/catest/ca_config.txt -subj \"/CN=" + current_id_str + "#" + namebuf + "\" -utf8 -batch -notext -out " + cert_filename + " -in " + filename; + std::string sign_command = (string)"openssl ca -config /home/root_jr/temp/catest/ca_config.txt -utf8 -subj \"/CN=" + current_id_str + "#" + namebuf + "\" -batch -notext -out " + cert_filename + " -in " + filename; puts(sign_command.c_str());//debug |
