Skip to content

Commit 8b81547

Browse files
dhowellsdavem330
authored andcommitted
RxRPC: Declare the security index constants symbolically
Declare the security index constants symbolically rather than just referring to them numerically. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 531afd6 commit 8b81547

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

include/linux/rxrpc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,12 @@ struct sockaddr_rxrpc {
5858
#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
5959
#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
6060

61+
/*
62+
* RxRPC security indices
63+
*/
64+
#define RXRPC_SECURITY_NONE 0 /* no security protocol */
65+
#define RXRPC_SECURITY_RXKAD 2 /* kaserver or kerberos 4 */
66+
#define RXRPC_SECURITY_RXGK 4 /* gssapi-based */
67+
#define RXRPC_SECURITY_RXK5 5 /* kerberos 5 */
6168

6269
#endif /* _LINUX_RXRPC_H */

net/rxrpc/ar-key.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int rxrpc_instantiate(struct key *key, const void *data, size_t datalen)
122122
tsec->ticket[6], tsec->ticket[7]);
123123

124124
ret = -EPROTONOSUPPORT;
125-
if (tsec->security_index != 2)
125+
if (tsec->security_index != RXRPC_SECURITY_RXKAD)
126126
goto error;
127127

128128
key->type_data.x[0] = tsec->security_index;
@@ -308,7 +308,7 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn,
308308
_debug("key %d", key_serial(key));
309309

310310
data.kver = 1;
311-
data.tsec.security_index = 2;
311+
data.tsec.security_index = RXRPC_SECURITY_RXKAD;
312312
data.tsec.ticket_len = 0;
313313
data.tsec.expiry = expiry;
314314
data.tsec.kvno = 0;

net/rxrpc/rxkad.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct rxkad_level2_hdr {
4242
__be32 checksum; /* decrypted data checksum */
4343
};
4444

45-
MODULE_DESCRIPTION("RxRPC network protocol type-2 security (Kerberos)");
45+
MODULE_DESCRIPTION("RxRPC network protocol type-2 security (Kerberos 4)");
4646
MODULE_AUTHOR("Red Hat, Inc.");
4747
MODULE_LICENSE("GPL");
4848

@@ -506,7 +506,7 @@ static int rxkad_verify_packet(const struct rxrpc_call *call,
506506
if (!call->conn->cipher)
507507
return 0;
508508

509-
if (sp->hdr.securityIndex != 2) {
509+
if (sp->hdr.securityIndex != RXRPC_SECURITY_RXKAD) {
510510
*_abort_code = RXKADINCONSISTENCY;
511511
_leave(" = -EPROTO [not rxkad]");
512512
return -EPROTO;
@@ -1122,7 +1122,7 @@ static void rxkad_clear(struct rxrpc_connection *conn)
11221122
static struct rxrpc_security rxkad = {
11231123
.owner = THIS_MODULE,
11241124
.name = "rxkad",
1125-
.security_index = RXKAD_VERSION,
1125+
.security_index = RXRPC_SECURITY_RXKAD,
11261126
.init_connection_security = rxkad_init_connection_security,
11271127
.prime_packet_security = rxkad_prime_packet_security,
11281128
.secure_packet = rxkad_secure_packet,

0 commit comments

Comments
 (0)