]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cls: Remove legacy ACL/Crypto class calls.
authorAlex Ainscow <aainscow@uk.ibm.com>
Mon, 24 Nov 2025 16:49:19 +0000 (16:49 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Fri, 28 Nov 2025 08:41:38 +0000 (08:41 +0000)
The osd code was not present, the radosacl tool did nothing useful and the scratchtoolpp
was testing something that doesn't exist.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/cls_acl.cc [deleted file]
src/cls_crypto.cc [deleted file]
src/tools/CMakeLists.txt
src/tools/radosacl.cc [deleted file]
src/tools/scratchtoolpp.cc

diff --git a/src/cls_acl.cc b/src/cls_acl.cc
deleted file mode 100644 (file)
index a9b2e8a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
-// vim: ts=8 sw=2 sts=2 expandtab
-
-#include <iostream>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <openssl/md5.h>
-#include <openssl/sha.h>
-
-#include "include/types.h"
-#include "objclass/objclass.h"
-
-CLS_VER(1,0)
-CLS_NAME(acl)
-
-int get_method(cls_method_context_t ctx, char *indata, int datalen,
-                                char **outdata, int *outdatalen)
-{
-   MD5_CTX c;
-
-   cls_log("acl test method");
-   cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
-
-   cls_getxattr(ctx, "acls", outdata, outdatalen);
-
-   return 0;
-}
-
-int set_method(cls_method_context_t ctx, char *indata, int datalen,
-                                char **outdata, int *outdatalen)
-{
-   MD5_CTX c;
-
-   cls_log("acl test method");
-   cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
-
-   cls_setxattr(ctx, "acls", indata, datalen);
-
-   return 0;
-}
-
-CLS_INIT(acl)
-{
-   cls_log("Loaded acl class!");
-
-   cls_handle_t h_class;
-   cls_method_handle_t h_get;
-   cls_method_handle_t h_set;
-
-   cls_register("acl", &h_class);
-   cls_register_method(h_class, "get", CLS_METHOD_RD, get_method, &h_get);
-   cls_register_method(h_class, "set", CLS_METHOD_WR, set_method, &h_set);
-
-   return;
-}
-
diff --git a/src/cls_crypto.cc b/src/cls_crypto.cc
deleted file mode 100644 (file)
index 21252d8..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
-// vim: ts=8 sw=2 sts=2 expandtab
-
-#include <iostream>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <openssl/md5.h>
-#include <openssl/sha.h>
-
-#include "include/types.h"
-#include "objclass/objclass.h"
-
-CLS_VER(1,0)
-CLS_NAME(crypto)
-
-int md5_method(cls_method_context_t ctx, char *indata, int datalen,
-                                char **outdata, int *outdatalen)
-{
-   MD5_CTX c;
-   unsigned char *md;
-
-   cls_log("md5 method");
-   cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
-
-   md = (unsigned char *)cls_alloc(MD5_DIGEST_LENGTH);
-   if (!md)
-     return -ENOMEM;
-
-   MD5_Init(&c);
-   MD5_Update(&c, indata, (unsigned long)datalen);
-   MD5_Final(md,&c);
-
-   *outdata = (char *)md;
-   *outdatalen = MD5_DIGEST_LENGTH;
-
-   return 0;
-}
-
-int sha1_method(cls_method_context_t ctx, char *indata, int datalen,
-                                char **outdata, int *outdatalen)
-{
-   SHA_CTX c;
-   unsigned char *md;
-
-   cls_log("sha1 method");
-   cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
-
-   md = (unsigned char *)cls_alloc(SHA_DIGEST_LENGTH);
-   if (!md)
-     return -ENOMEM;
-
-   SHA1_Init(&c);
-   SHA1_Update(&c, indata, (unsigned long)datalen);
-   SHA1_Final(md,&c);
-
-   *outdata = (char *)md;
-   *outdatalen = SHA_DIGEST_LENGTH;
-
-   return 0;
-}
-
-CLS_INIT(crypto)
-{
-   cls_log("Loaded crypto class!");
-
-   cls_handle_t h_class;
-   cls_method_handle_t h_md5;
-   cls_method_handle_t h_sha1;
-
-   cls_register("crypto", &h_class);
-   cls_register_method(h_class, "md5", CLS_METHOD_RD, md5_method, &h_md5);
-   cls_register_method(h_class, "sha1", CLS_METHOD_RD, sha1_method, &h_sha1);
-
-   return;
-}
-
index ee8ff3f24bc880cd867d28ac5c09cf9cad56e82c..c4eb9218c079cda184945c432361e974848f6250 100644 (file)
@@ -37,10 +37,6 @@ add_executable(ceph_scratchtoolpp scratchtoolpp.cc)
 target_link_libraries(ceph_scratchtoolpp librados global)
 install(TARGETS ceph_scratchtoolpp DESTINATION bin)
 
-add_executable(ceph_radosacl radosacl.cc)
-target_link_libraries(ceph_radosacl librados global)
-install(TARGETS ceph_radosacl DESTINATION bin)
-
 install(PROGRAMS
   ceph-monstore-update-crush.sh
   DESTINATION ${CMAKE_INSTALL_LIBDIR}/ceph)
diff --git a/src/tools/radosacl.cc b/src/tools/radosacl.cc
deleted file mode 100644 (file)
index e6eb580..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*- 
-// vim: ts=8 sw=2 sts=2 expandtab
-
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#include <stdlib.h>
-#include <time.h>
-#include <errno.h>
-
-#include <iostream> // for std::cerr
-
-#include "include/encoding.h"
-#include "include/int_types.h" // for __u32
-#include "include/types.h"
-#include "include/rados/librados.hpp"
-
-using namespace std;
-using namespace librados;
-
-void buf_to_hex(const unsigned char *buf, int len, char *str)
-{
-  str[0] = '\0';
-  for (int i = 0; i < len; i++) {
-    sprintf(&str[i*2], "%02x", (int)buf[i]);
-  }
-}
-
-
-#define ID_SIZE 8
-
-#define ACL_RD 0x1
-#define ACL_WR 0x2
-
-struct ACLID {
-  char id[ID_SIZE + 1];
-
-  void encode(bufferlist& bl) const {
-    bl.append((const char *)id, ID_SIZE);
-  }
-  void decode(bufferlist::const_iterator& iter) {
-    iter.copy(ID_SIZE, (char *)id);
-  }
-};
-WRITE_CLASS_ENCODER(ACLID)
-
-typedef __u32 ACLFlags;
-
-
-inline bool operator<(const ACLID& l, const ACLID& r)
-{
-  return (memcmp(&l, &r, ID_SIZE) < 0);
-}
-
-struct ACLPair {
-  ACLID id;
-  ACLFlags flags;
-};
-
-class ObjectACLs {
-  map<ACLID, ACLFlags> acls_map;
-
-public:
-
-  void encode(bufferlist& bl) const {
-    using ceph::encode;
-    encode(acls_map, bl);
-  }
-  void decode(bufferlist::const_iterator& bl) {
-    using ceph::decode;
-    decode(acls_map, bl);
-  }
-
-  int read_acl(ACLID& id, ACLFlags *flags);
-  void set_acl(ACLID& id, ACLFlags flags);
-};
-WRITE_CLASS_ENCODER(ObjectACLs)
-
-int ObjectACLs::read_acl(ACLID& id, ACLFlags *flags)
-{
-  if (!flags)
-    return -EINVAL;
-
-  map<ACLID, ACLFlags>::iterator iter = acls_map.find(id);
-
-  if (iter == acls_map.end())
-    return -ENOENT;
-
-  *flags = iter->second;
-
-  return 0;
-}
-
-void ObjectACLs::set_acl(ACLID& id, ACLFlags flags)
-{
-  acls_map[id] = flags;
-}
-
-
-
-class ACLEntity
-{
-  string name;
-  map<ACLID, ACLEntity> groups;
-};
-
-typedef map<ACLID, ACLEntity> tACLIDEntityMap;
-
-static map<ACLID, ACLEntity> users;
-static map<ACLID, ACLEntity> groups;
-
-void get_user(ACLID& aclid, ACLEntity *entity)
-{
-  //users.find(aclid);
-}
-
-
-
-
-
-int main(int argc, const char **argv) 
-{
-  Rados rados;
-  if (rados.init(NULL) < 0) {
-     cerr << "couldn't initialize rados!" << std::endl;
-     exit(1);
-  }
-  if (rados.conf_read_file(NULL)) {
-     cerr << "couldn't read Ceph configuration file!" << std::endl;
-     exit(1);
-  }
-  if (rados.connect() < 0) {
-     cerr << "couldn't connect to cluster!" << std::endl;
-     exit(1);
-  }
-
-  time_t tm;
-  bufferlist bl, bl2;
-  char buf[128];
-
-  time(&tm);
-  snprintf(buf, 128, "%s", ctime(&tm));
-  bl.append(buf, strlen(buf));
-
-  const char *oid = "bar";
-
-  IoCtx io_ctx;
-  int r = rados.ioctx_create("data", io_ctx);
-  cout << "open io_ctx result = " << r << " pool = " << io_ctx.get_pool_name() << std::endl;
-
-  ACLID id;
-
-  snprintf(id.id, sizeof(id.id), "%.8x", 0x1234);
-  cout << "id=" << id.id << std::endl;
-
-  r = io_ctx.exec(oid, "acl", "get", bl, bl2);
-  cout << "exec(acl get) returned " << r
-       << " len=" << bl2.length() << std::endl;
-  ObjectACLs oa;
-  if (r >= 0) {
-    auto iter = bl2.cbegin();
-    oa.decode(iter);
-  }
-
-  oa.set_acl(id, ACL_RD);
-  bl.clear();
-  oa.encode(bl);
-  r = io_ctx.exec(oid, "acl", "set", bl, bl2);
-  cout << "exec(acl set) returned " << r
-       << " len=" << bl2.length() << std::endl;
-
-  const unsigned char *md5 = (const unsigned char *)bl2.c_str();
-  char md5_str[bl2.length()*2 + 1];
-  buf_to_hex(md5, bl2.length(), md5_str);
-  cout << "md5 result=" << md5_str << std::endl;
-
-  int size = io_ctx.read(oid, bl2, 128, 0);
-  cout << "read result=" << bl2.c_str() << std::endl;
-  cout << "size=" << size << std::endl;
-
-  return 0;
-}
-
index 076667f18ea179345f391bebda58886ef92c87e6..1c84632cd6391329271a70f9d697710376a9f3f7 100644 (file)
@@ -170,12 +170,6 @@ int main(int argc, const char **argv)
   cout << "rados.trunc returned " << r << std::endl;
   r = io_ctx.read(oid, bl, bl.length(), 0);
   cout << "rados.read returned " << r << std::endl;
-  r = io_ctx.exec(oid, "crypto", "md5", bl, bl2);
-  cout << "exec returned " << r <<  " buf size=" << bl2.length() << std::endl;
-  const unsigned char *md5 = (const unsigned char *)bl2.c_str();
-  char md5_str[bl2.length()*2 + 1];
-  buf_to_hex(md5, bl2.length(), md5_str);
-  cout << "md5 result=" << md5_str << std::endl;
 
   // test assert_version
   r = io_ctx.read(oid, bl, 0, 1);
@@ -193,21 +187,6 @@ int main(int argc, const char **argv)
   r = io_ctx.read(oid, bl, 0, 1);
   ceph_assert(r == -EOVERFLOW);
 
-  r = io_ctx.exec(oid, "crypto", "sha1", bl, bl2);
-  cout << "exec returned " << r << std::endl;
-  const unsigned char *sha1 = (const unsigned char *)bl2.c_str();
-  char sha1_str[bl2.length()*2 + 1];
-  buf_to_hex(sha1, bl2.length(), sha1_str);
-  cout << "sha1 result=" << sha1_str << std::endl;
-
-  r = io_ctx.exec(oid, "acl", "set", bl, bl2);
-  cout << "exec (set) returned " << r << std::endl;
-  r = io_ctx.exec(oid, "acl", "get", bl, bl2);
-  cout << "exec (get) returned " << r << std::endl;
-  if (bl2.length() > 0) {
-    cout << "attr=" << bl2.c_str() << std::endl;
-  }
-
   int size = io_ctx.read(oid, bl2, 128, 0);
   if (size <= 0) {
     cout << "failed to read oid " << oid << "." << std::endl;