Skip to content

Commit

Permalink
libssh: enforce semicolons when using macros
Browse files Browse the repository at this point in the history
This enforces the usage of semicolons when using CPP macros. We
currently use semicolons anyway, however this leads to certain warnings
on certain compilers.

Fixes curl#6847
Closes curl#6848
  • Loading branch information
emilengler committed Apr 6, 2021
1 parent f573998 commit 657f034
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lib/vssh/libssh.c
Expand Up @@ -549,49 +549,52 @@ static int myssh_is_known(struct Curl_easy *data)
return rc;
}

#define MOVE_TO_ERROR_STATE(_r) { \
#define MOVE_TO_ERROR_STATE(_r) do { \
state(data, SSH_SESSION_DISCONNECT); \
sshc->actualcode = _r; \
rc = SSH_ERROR; \
break; \
}
} while(0); \
break

#define MOVE_TO_SFTP_CLOSE_STATE() { \
#define MOVE_TO_SFTP_CLOSE_STATE() do { \
state(data, SSH_SFTP_CLOSE); \
sshc->actualcode = sftp_error_to_CURLE(sftp_get_error(sshc->sftp_session)); \
rc = SSH_ERROR; \
break; \
}
} while(0)

#define MOVE_TO_LAST_AUTH \
#define MOVE_TO_LAST_AUTH do { \
if(sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD) { \
rc = SSH_OK; \
state(data, SSH_AUTH_PASS_INIT); \
break; \
} \
else { \
MOVE_TO_ERROR_STATE(CURLE_LOGIN_DENIED); \
}
} \
} while(0)

#define MOVE_TO_TERTIARY_AUTH \
#define MOVE_TO_TERTIARY_AUTH do { \
if(sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE) { \
rc = SSH_OK; \
state(data, SSH_AUTH_KEY_INIT); \
break; \
} \
else { \
MOVE_TO_LAST_AUTH; \
}
} \
} while(0)

#define MOVE_TO_SECONDARY_AUTH \
#define MOVE_TO_SECONDARY_AUTH do { \
if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { \
rc = SSH_OK; \
state(data, SSH_AUTH_GSSAPI); \
break; \
} \
else { \
MOVE_TO_TERTIARY_AUTH; \
}
} \
} while(0)

static
int myssh_auth_interactive(struct connectdata *conn)
Expand Down

0 comments on commit 657f034

Please sign in to comment.