| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Various SSL functions. | 2 * Various SSL functions. |
| 3 * | 3 * |
| 4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
| 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 6 * | 6 * |
| 7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
| 8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
| 9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
| 10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 ss->sec.hashcx = NULL; | 895 ss->sec.hashcx = NULL; |
| 896 } | 896 } |
| 897 | 897 |
| 898 SECITEM_CopyItem(0, &ss->sec.sendSecret, &os->sec.sendSecret); | 898 SECITEM_CopyItem(0, &ss->sec.sendSecret, &os->sec.sendSecret); |
| 899 if (os->sec.sendSecret.data && !ss->sec.sendSecret.data) | 899 if (os->sec.sendSecret.data && !ss->sec.sendSecret.data) |
| 900 goto loser; | 900 goto loser; |
| 901 SECITEM_CopyItem(0, &ss->sec.rcvSecret, &os->sec.rcvSecret); | 901 SECITEM_CopyItem(0, &ss->sec.rcvSecret, &os->sec.rcvSecret); |
| 902 if (os->sec.rcvSecret.data && !ss->sec.rcvSecret.data) | 902 if (os->sec.rcvSecret.data && !ss->sec.rcvSecret.data) |
| 903 goto loser; | 903 goto loser; |
| 904 | 904 |
| 905 SECITEM_CopyItem(0, ss->sec.userName, os->sec.userName); |
| 906 if (os->sec.userName->data && !ss->sec.userName->data) |
| 907 goto loser; |
| 908 SECITEM_CopyItem(0, ss->sec.userPasswd, os->sec.userPasswd); |
| 909 if (os->sec.userPasswd->data && !ss->sec.userPasswd->data) |
| 910 goto loser; |
| 911 |
| 912 |
| 905 /* XXX following code is wrong if either cx != 0 */ | 913 /* XXX following code is wrong if either cx != 0 */ |
| 906 PORT_Assert(os->sec.readcx == 0); | 914 PORT_Assert(os->sec.readcx == 0); |
| 907 PORT_Assert(os->sec.writecx == 0); | 915 PORT_Assert(os->sec.writecx == 0); |
| 908 ss->sec.readcx = os->sec.readcx; | 916 ss->sec.readcx = os->sec.readcx; |
| 909 ss->sec.writecx = os->sec.writecx; | 917 ss->sec.writecx = os->sec.writecx; |
| 910 ss->sec.destroy = 0; | 918 ss->sec.destroy = 0; |
| 911 | 919 |
| 912 ss->sec.enc = os->sec.enc; | 920 ss->sec.enc = os->sec.enc; |
| 913 ss->sec.dec = os->sec.dec; | 921 ss->sec.dec = os->sec.dec; |
| 914 | 922 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 /* | 984 /* |
| 977 ** Called from SSL_ResetHandshake (above), and | 985 ** Called from SSL_ResetHandshake (above), and |
| 978 ** from ssl_FreeSocket in sslsock.c | 986 ** from ssl_FreeSocket in sslsock.c |
| 979 ** Caller should hold relevant locks (e.g. XmitBufLock) | 987 ** Caller should hold relevant locks (e.g. XmitBufLock) |
| 980 */ | 988 */ |
| 981 void | 989 void |
| 982 ssl_DestroySecurityInfo(sslSecurityInfo *sec) | 990 ssl_DestroySecurityInfo(sslSecurityInfo *sec) |
| 983 { | 991 { |
| 984 ssl_ResetSecurityInfo(sec, PR_FALSE); | 992 ssl_ResetSecurityInfo(sec, PR_FALSE); |
| 985 | 993 |
| 994 if (sec->userName) { |
| 995 SECITEM_FreeItem(sec->userName, PR_TRUE); |
| 996 sec->userName = NULL; |
| 997 } |
| 998 if (sec->userPasswd) { |
| 999 SECITEM_FreeItem(sec->userPasswd, PR_TRUE); |
| 1000 sec->userPasswd = NULL; |
| 1001 } |
| 1002 |
| 986 PORT_ZFree(sec->writeBuf.buf, sec->writeBuf.space); | 1003 PORT_ZFree(sec->writeBuf.buf, sec->writeBuf.space); |
| 987 sec->writeBuf.buf = 0; | 1004 sec->writeBuf.buf = 0; |
| 988 | 1005 |
| 989 memset(sec, 0, sizeof *sec); | 1006 memset(sec, 0, sizeof *sec); |
| 990 } | 1007 } |
| 991 | 1008 |
| 992 /************************************************************************/ | 1009 /************************************************************************/ |
| 993 | 1010 |
| 994 int | 1011 int |
| 995 ssl_SecureConnect(sslSocket *ss, const PRNetAddr *sa) | 1012 ssl_SecureConnect(sslSocket *ss, const PRNetAddr *sa) |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 if (!ss) { | 1547 if (!ss) { |
| 1531 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", | 1548 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", |
| 1532 SSL_GETPID(), fd)); | 1549 SSL_GETPID(), fd)); |
| 1533 return SECFailure; | 1550 return SECFailure; |
| 1534 } | 1551 } |
| 1535 | 1552 |
| 1536 ss->sniSocketConfig = func; | 1553 ss->sniSocketConfig = func; |
| 1537 ss->sniSocketConfigArg = arg; | 1554 ss->sniSocketConfigArg = arg; |
| 1538 return SECSuccess; | 1555 return SECSuccess; |
| 1539 } | 1556 } |
| OLD | NEW |