ceph: add struct version to auth encoding
authorSage Weil <sage@newdream.net>
Thu, 4 Feb 2010 17:42:20 +0000 (09:42 -0800)
committerSage Weil <sage@newdream.net>
Wed, 10 Feb 2010 23:04:48 +0000 (15:04 -0800)
Inlucde struct version in encoding. This will streamline future protocol
changes.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/auth.c
fs/ceph/auth_none.c

index d5872d4f92bfbdca14eadd65ff03d7d6425745b8..b34ce0e41b4cba340b496829d54f08f687200d87 100644 (file)
@@ -107,8 +107,11 @@ int ceph_auth_build_hello(struct ceph_auth_client *ac, void *buf, size_t len)
        lenp = p;
        p += sizeof(u32);
 
+       ceph_decode_need(&p, end, 1 + sizeof(u32), bad);
+       ceph_encode_8(&p, 1);
        num = ARRAY_SIZE(supported_protocols);
        ceph_encode_32(&p, num);
+       ceph_decode_need(&p, end, num * sizeof(u32), bad);
        for (i = 0; i < num; i++)
                ceph_encode_32(&p, supported_protocols[i]);
 
index 631017eb7117e4d7ddd0dff1421aa72ce28647a6..b4ef6f0a6c856d42691ea55406ebfad824a6d763 100644 (file)
@@ -62,6 +62,7 @@ static int ceph_auth_none_create_authorizer(
        if (!ai->built_authorizer) {
                p = au->buf;
                end = p + sizeof(au->buf);
+               ceph_encode_8(&p, 1);
                ret = ceph_entity_name_encode(ac->name, &p, end - 8);
                if (ret < 0)
                        goto bad;