CERT2_REQUESTED = (1<<2),
};
-struct cert_request
-{
+struct cert_request {
unsigned int state:16;
unsigned int hashes:16;
};
if (hash == OPENCONNECT_HASH_UNKNOWN) {
vpn_progress(vpninfo, PRG_INFO,
_("Unsupported hash algorithm '%s' requested.\n"),
- (char*) content);
+ (char *) content);
goto next;
}
if (oldhashes == cert_rq->hashes)
vpn_progress(vpninfo, PRG_INFO,
_("Duplicate hash algorithm '%s' requested.\n"),
- (char*) content);
+ (char *) content);
next:
xmlFree(content);
const xmlChar *hashname;
xmlDocPtr doc;
xmlNodePtr root, auth, node, chain;
-
+
doc = xmlpost_new_query(vpninfo, "auth-reply", &root);
if (!doc)
goto bad;
#include <afunix.h>
#else
#define UNIX_PATH_MAX 108
-struct sockaddr_un
-{
+struct sockaddr_un {
ADDRESS_FAMILY sun_family; /* AF_UNIX */
char sun_path[UNIX_PATH_MAX]; /* pathname */
-} SOCKADDR_UN, *PSOCKADDR_UN;;
+} SOCKADDR_UN, *PSOCKADDR_UN;
#endif /* HAS_AFUNIX_H */
/* dumb_socketpair:
if (setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,
(char *) &reuse, (socklen_t) sizeof(reuse)) == -1)
- goto fallback;;
+ goto fallback;
if (bind(listener, &a.addr, addrlen) == SOCKET_ERROR)
goto fallback;
}
#endif /* HAVE_PKCS11 */
- certinfo->priv_info = gci = calloc(1, sizeof *gci);
+ certinfo->priv_info = gci = calloc(1, sizeof(*gci));
if (!gci) {
ret = -ENOMEM;
goto out;
* If not, disable TLSv1.3 which would make PSS mandatory.
* https://bugzilla.redhat.com/show_bug.cgi?id=1663058
*/
- gnutls_datum_t fdata= { (void *)gci, sizeof *gci };
+ gnutls_datum_t fdata= { (void *)gci, sizeof(*gci) };
gnutls_datum_t pkey_sig = { NULL, 0 };
err = gnutls_privkey_sign_data2(gci->pkey, GNUTLS_SIGN_RSA_PSS_RSAE_SHA256, 0, &fdata, &pkey_sig);
int aes_256_gcm_decrypt(struct openconnect_info *vpninfo, unsigned char *key,
unsigned char *data, int len,
unsigned char *iv, unsigned char *tag)
- {
+{
gnutls_cipher_hd_t h = NULL;
gnutls_datum_t d = { key, SHA256_SIZE };
if (err >= 0)
return 0;
- switch (err)
- {
+ switch (err) {
case GNUTLS_E_MEMORY_ERROR:
- return -ENOMEM;
+ return -ENOMEM;
case GNUTLS_E_ILLEGAL_PARAMETER:
case GNUTLS_E_INVALID_REQUEST:
- return -EINVAL;
+ return -EINVAL;
case GNUTLS_E_CONSTRAINT_ERROR:
case GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM:
default:
- return -EIO;
+ return -EIO;
}
}
*/
for (kp = 0; ; kp++) {
- size_t oid_size = sizeof oid;
+ size_t oid_size = sizeof(oid);
err = gnutls_x509_crt_get_key_purpose_oid(crt, kp,
oid, &oid_size,
&critical);
*/
if (kp > 0 || usage != 0) {
vpn_progress(vpninfo, PRG_INFO,
- _("The certificate specifies key usages "
- "incompatible with authentication.\n"));
+ _("The certificate specifies key usages incompatible with authentication.\n"));
return 0;
}
DEFAULT_EXTERNAL_BROWSER);
pid_t pid = 0;
- char * browser_argv[3] = { (char *)DEFAULT_EXTERNAL_BROWSER, vpninfo->sso_login, NULL };
+ char *browser_argv[3] = { (char *)DEFAULT_EXTERNAL_BROWSER, vpninfo->sso_login, NULL };
if (posix_spawn(&pid, DEFAULT_EXTERNAL_BROWSER, NULL, NULL, browser_argv, environ)) {
ret = -errno;
#include "openconnect-internal.h"
-#define NELEM(array) (sizeof(array)/sizeof(array[0]))
-
static const struct {
openconnect_hash_type id;
const char *name;
{
size_t i;
- if (id > 0 && (size_t) id < NELEM(digest_table)) {
+ if (id > 0 && (size_t) id < ARRAY_SIZE(digest_table)) {
i = (size_t) id;
if (digest_table[i].id)
return digest_table[i].name;
size_t i;
if (name) {
- for (i = 1; i < NELEM(digest_table); i++) {
+ for (i = 1; i < ARRAY_SIZE(digest_table); i++) {
if (digest_table[i].name &&
!strcmp(digest_table[i].name, name))
return digest_table[i].id;
#define OC_FORM_OPT_SELECT 3
#define OC_FORM_OPT_HIDDEN 4
#define OC_FORM_OPT_TOKEN 5
-#define OC_FORM_OPT_SSO_TOKEN 6
-#define OC_FORM_OPT_SSO_USER 7
+#define OC_FORM_OPT_SSO_TOKEN 6
+#define OC_FORM_OPT_SSO_USER 7
#define OC_FORM_RESULT_ERR -1
#define OC_FORM_RESULT_OK 0
(void) flags;
- certinfo->priv_info = oci = calloc(1, sizeof *oci);
+ certinfo->priv_info = oci = calloc(1, sizeof(*oci));
if (!oci) {
ret = -ENOMEM;
goto done;
static int handle_attr_elements(struct openconnect_info *vpninfo,
unsigned char *bytes, int len,
struct oc_vpn_option **new_opts,
- struct oc_ip_info *new_ip_info) {
+ struct oc_ip_info *new_ip_info)
+{
unsigned char *p = bytes;
int l = len;
} ip6_ctlun;
struct in6_addr ip6_src; /* source address */
struct in6_addr ip6_dst; /* destination address */
- };
+};
#define ip6_vfc ip6_ctlun.ip6_un2_vfc