Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-24633] Delete owner information from schema, index, trigger, and object files of general users. #4136

Merged
merged 10 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion msg/de_DE.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ gültige Optionen:\n\
-S, --SA-mode Stand-Alone-Ausführung\n\
-C, --CS-mode Client-Server-Ausführung\n\
--datafile-per-class eine Objektdatei für jede Klasse erzeugen; Standard: inaktiv\n\
--split-schema-files Schemainformationen nach Objekt aufteilen und jede Datei generieren; Standard: Eine Schemadatei mit allen Objekten generieren\n
--split-schema-files Schemainformationen nach Objekt aufteilen und jede Datei generieren; Standard: Eine Schemadatei mit allen Objekten generieren\n\
--as-dba Als de ingelogde gebruiker lid is van de DBA-groep, pak dan hetzelfde schemabestand uit als de DBA.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/en_US.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ valid options:\n\
-S, --SA-mode stand-alone mode execution\n\
-C, --CS-mode client-server mode execution\n\
--datafile-per-class create a object file for each class; default: disabled\n\
--split-schema-files Split schema information by object and generate each file; Default: generate one schema file with all objects\n
--split-schema-files Split schema information by object and generate each file; Default: generate one schema file with all objects\n\
--as-dba If the login user is a member of the DBA group, extract the same schema file as the DBA.\n


$set 14 MSGCAT_UTIL_SET_COMPACTDB
Expand Down
3 changes: 2 additions & 1 deletion msg/en_US/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ valid options:\n\
-S, --SA-mode stand-alone mode execution\n\
-C, --CS-mode client-server mode execution\n\
--datafile-per-class create a object file for each class; default: disabled\n\
--split-schema-files split schema information by object and generate each file; Default: generate one schema file with all objects\n
--split-schema-files split schema information by object and generate each file; Default: generate one schema file with all objects\n\
--as-dba If the login user is a member of the DBA group, extract the same schema file as the DBA.\n


$set 14 MSGCAT_UTIL_SET_COMPACTDB
Expand Down
3 changes: 2 additions & 1 deletion msg/es_ES.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ opciones validas:\n\
-S, --SA-mode modo de ejecucion independiente\n\
-C, --CS-mode modo de ejecucion cliente-servidor\n\
--datafile-per-class crear un archivo de objeto para cada clase; estandar: inhabilitado\n\
--split-schema-files dividir la información del esquema por objeto y generar cada archivo; Predeterminado: generar un archivo de esquema con todos los objetos\n
--split-schema-files dividir la información del esquema por objeto y generar cada archivo; Predeterminado: generar un archivo de esquema con todos los objetos\n\
--as-dba Si el usuario de inicio de sesión es miembro del grupo DBA, extraiga el mismo archivo de esquema que el DBA.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/fr_FR.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ options valids:\n\
-S, --SA-mode exécution en mode autonome\n\
-C, --CS-mode exécution en mode client-serveur\n\
--datafile-per-class créer un fichier objet pour chaque classe; par défaut: désactivé\n\
--split-schema-files diviser les informations de schéma par objet et générer chaque fichier ; Par défaut : générer un fichier de schéma avec tous les objets\n
--split-schema-files diviser les informations de schéma par objet et générer chaque fichier ; Par défaut : générer un fichier de schéma avec tous les objets\n\
--as-dba Si l'utilisateur de connexion est membre du groupe DBA, extrayez le même fichier de schéma que le DBA.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/it_IT.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ opzioni valide:\n\
-S, --SA-mode modalità di esecuzione stand-alone\n\
-C, --CS-mode modalità di esecuzione client-server\n\
--datafile-per-class creare un file oggetto per ogni classe; predefinito: non attivo\n\
--split-schema-files dividere le informazioni sullo schema per oggetto e generare ciascun file; Predefinito: genera un file schema con tutti gli oggetti\n
--split-schema-files dividere le informazioni sullo schema per oggetto e generare ciascun file; Predefinito: genera un file schema con tutti gli oggetti\n\
--as-dba Se l'utente di accesso è un membro del gruppo DBA, estrai lo stesso file di schema del DBA.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/ja_JP.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ unloaddb: データベースからスキーマとオブジェクトをアンロ
-S, --SA-mode 独立モードで実行\n\
-C, --CS-mode クライアントーサーバモードで実行\n\
--datafile-per-class 格クラス別にオブジェクトファイル生成; デフォルト: ひとつのオブジェクトファイルを生成\n\
--split-schema-files オブジェクトごとにスキーマ情報を分割し、各ファイルを生成します。 デフォルト: すべてのオブジェクトを含む 1 つのスキーマ ファイルを生成する\n
--split-schema-files オブジェクトごとにスキーマ情報を分割し、各ファイルを生成します。 デフォルト: すべてのオブジェクトを含む 1 つのスキーマ ファイルを生成する\n\
--as-dba ログイン ユーザーが DBA グループのメンバーである場合、DBA と同じスキーマ ファイルを抽出します。\n



Expand Down
3 changes: 2 additions & 1 deletion msg/km_KH.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ valid options:\n\
-S, --SA-mode stand-alone mode execution\n\
-C, --CS-mode client-server mode execution\n\
--datafile-per-class create a object file for each class; default: disabled\n\
--split-schema-files Split schema information by object and generate each file; Default: generate one schema file with all objects\n
--split-schema-files Split schema information by object and generate each file; Default: generate one schema file with all objects\n\
--as-dba If the login user is a member of the DBA group, extract the same schema file as the DBA.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/ko_KR.euckr/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ unloaddb:
-S, --SA-mode ���� ��� ����\n\
-C, --CS-mode Ŭ���̾�Ʈ ���� ��� ����\n\
--datafile-per-class �� Ŭ������ ������Ʈ ���� ����; �⺻��:�� ���� ������Ʈ ���ϻ���\n\
--split-schema-files ��Ű�� ������ ������Ʈ���� �и��Ͽ� ������ ���Ϸ� ����; �⺻��: ��� ������Ʈ�� ���Ե� �� ���� ��Ű�� ���� ����\n
--split-schema-files ��Ű�� ������ ������Ʈ���� �и��Ͽ� ������ ���Ϸ� ����; �⺻��: ��� ������Ʈ�� ���Ե� �� ���� ��Ű�� ���� ����\n\
--as-dba �α��� ����ڰ� DBA �׷��� �������� ��� DBA�� ������ ��Ű�� ������ �����մϴ�.\n



Expand Down
4 changes: 2 additions & 2 deletions msg/ko_KR.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ unloaddb: 데이터베이스에서 스키마와 객체를 언로드\n\
-S, --SA-mode 독립 모드 실행\n\
-C, --CS-mode 클라이언트 서버 모드 실행\n\
--datafile-per-class 각 클래스별 오브젝트 파일 생성; 기본값:한 개의 오브젝트 파일생성\n\
--split-schema-files 스키마 정보를 오브젝트별로 분리하여 각각의 파일로 생성; 기본값: 모든 오브젝트가 포함된 한 개의 스키마 파일 생성\n

--split-schema-files 스키마 정보를 오브젝트별로 분리하여 각각의 파일로 생성; 기본값: 모든 오브젝트가 포함된 한 개의 스키마 파일 생성\n\
--as-dba 로그인 사용자가 DBA 그룹의 구성원인 경우 DBA와 동일한 스키마 파일을 추출합니다.\n

$set 14 MSGCAT_UTIL_SET_COMPACTDB
11 \n패스 1\n\n
Expand Down
3 changes: 2 additions & 1 deletion msg/ro_RO.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ opţiuni valide:\n\
-S, --SA-mode mod de execuţie independent\n\
-C, --CS-mode mod de execuţie client-server\n\
--datafile-per-class creează un fişier obiect pentru fieacre clasă; implicit: dezactivat\n\
--split-schema-files împărțiți informațiile de schemă pe obiect și generați fiecare fișier; Implicit: generați un fișier de schemă cu toate obiectele\n
--split-schema-files împărțiți informațiile de schemă pe obiect și generați fiecare fișier; Implicit: generați un fișier de schemă cu toate obiectele\n\
--as-dba Dacă utilizatorul de conectare este membru al grupului DBA, extrageți același fișier de schemă ca și DBA.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/tr_TR.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ geçerli seçenekler:\n\
-S, --SA-mode stand-alone modu yürütme\n\
-C, --CS-mode istemci-sunucu modunda yürütme\n\
--datafile-per-class her sınıf için bir nesne dosyası oluşturmak; varsayılan: devre dışı\n\
--split-schema-files şema bilgilerini nesneye göre ayırın ve her dosyayı oluşturun; Varsayılan: tüm nesnelerle bir şema dosyası oluştur\n
--split-schema-files şema bilgilerini nesneye göre ayırın ve her dosyayı oluşturun; Varsayılan: tüm nesnelerle bir şema dosyası oluştur\n\
--as-dba Oturum açan kullanıcı DBA grubunun bir üyesiyse, DBA ile aynı şema dosyasını ayıklayın.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/vi_VN.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ valid options:\n\
-S, --SA-mode stand-alone mode execution\n\
-C, --CS-mode client-server mode execution\n\
--datafile-per-class create a object file for each class; default: disabled\n\
--split-schema-files split schema information by object and generate each file; Default: generate one schema file with all objects\n
--split-schema-files split schema information by object and generate each file; Default: generate one schema file with all objects\n\
--as-dba If the login user is a member of the DBA group, extract the same schema file as the DBA.\n



Expand Down
3 changes: 2 additions & 1 deletion msg/zh_CN.utf8/utils.msg
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ unloaddb: 从数据库导出对象和结构.\n\
-S, --SA-mode 单机模式执行\n\
-C, --CS-mode 客户端-服务器模式执行\n\
--datafile-per-class 为每个表创建一个对象文件; 默认: 禁止\n\
--split-schema-files 按对象拆分模式信息并生成每个文件; 默认:生成一个包含所有对象的模式文件\n
--split-schema-files 按对象拆分模式信息并生成每个文件; 默认:生成一个包含所有对象的模式文件\n\
--as-dba 如果登录用户是 DBA 组的成员,则提取与 DBA 相同的架构文件。\n



Expand Down
6 changes: 6 additions & 0 deletions src/executables/extract_schema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ struct extract_context
int do_auth;
EMIT_STORAGE_ORDER storage_order;
const char *exec_name;
const char *login_user;
const char *output_dirname;
const char *output_prefix;
bool is_dba_user;
bool is_dba_group_member;

/* working */
int has_indexes;
Expand All @@ -55,8 +58,11 @@ struct extract_context
do_auth (0),
storage_order (FOLLOW_STORAGE_ORDER),
exec_name (NULL),
login_user(NULL),
output_dirname(NULL),
output_prefix(NULL),
is_dba_user (false),
is_dba_group_member (false),
has_indexes (0),
schema_file_list(NULL),
classes (NULL),
Expand Down
59 changes: 40 additions & 19 deletions src/executables/unload_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void extractobjects_cleanup (void);
static void extractobjects_term_handler (int sig);
static bool mark_referenced_domain (SM_CLASS * class_ptr, int *num_set);
static void gauge_alarm_handler (int sig);
static int process_class (int cl_no);
static int process_class (extract_context & ctxt, int cl_no);
static int process_object (DESC_OBJ * desc_obj, OID * obj_oid, int referenced_class);
static int process_set (DB_SET * set);
static int process_value (DB_VALUE * value);
Expand Down Expand Up @@ -433,7 +433,7 @@ mark_referenced_domain (SM_CLASS * class_ptr, int *num_set)
* exec_name(in): utility name
*/
int
extract_objects (const char *exec_name, const char *output_dirname, const char *output_prefix)
extract_objects (extract_context & ctxt, const char *output_dirname)
{
int i, error;
HFID *hfid;
Expand All @@ -456,6 +456,7 @@ extract_objects (const char *exec_name, const char *output_dirname, const char *
char unloadlog_filename[PATH_MAX];
char owner_name[DB_MAX_IDENTIFIER_LENGTH] = { '\0' };
char *class_name = NULL;
char owner_str[DB_MAX_USER_LENGTH + 4] = { '\0' };

/* register new signal handlers */
prev_intr_handler = os_set_signal_handler (SIGINT, extractobjects_term_handler);
Expand Down Expand Up @@ -496,12 +497,12 @@ extract_objects (const char *exec_name, const char *output_dirname, const char *
{
return 1;
}
snprintf (output_filename, PATH_MAX - 1, "%s/%s%s", output_dirname, output_prefix, OBJECT_SUFFIX);
snprintf (output_filename, PATH_MAX - 1, "%s/%s%s", output_dirname, ctxt.output_prefix, OBJECT_SUFFIX);

obj_out->fp = fopen_ex (output_filename, "wb");
if (obj_out->fp == NULL)
{
fprintf (stderr, "%s: %s.\n\n", exec_name, strerror (errno));
fprintf (stderr, "%s: %s.\n\n", ctxt.exec_name, strerror (errno));
free_and_init (output_filename);
return errno;
}
Expand Down Expand Up @@ -632,6 +633,14 @@ extract_objects (const char *exec_name, const char *output_dirname, const char *
fprintf (stdout, "%s%s%s\n", PRINT_IDENTIFIER (sm_ch_name ((MOBJ) class_ptr)));
#endif /* CUBRID_DEBUG */

SPLIT_USER_SPECIFIED_NAME (sm_ch_name ((MOBJ) class_ptr), owner_name, class_name);

if ((ctxt.is_dba_user == false && ctxt.is_dba_group_member == false)
&& strcasecmp (owner_name, ctxt.login_user) != 0)
{
continue;
}

fh_put (cl_table, ws_oid (class_table->mops[i]), &i);
if (input_filename)
{
Expand Down Expand Up @@ -661,9 +670,11 @@ extract_objects (const char *exec_name, const char *output_dirname, const char *

if (!datafile_per_class && (!required_class_only || IS_CLASS_REQUESTED (i)))
{
SPLIT_USER_SPECIFIED_NAME (sm_ch_name ((MOBJ) class_ptr), owner_name, class_name);
PRINT_OWNER_NAME (owner_name, (ctxt.is_dba_user || ctxt.is_dba_group_member), owner_str,
sizeof (owner_str));

if (text_print
(obj_out, NULL, 0, "%cid %s%s%s.%s%s%s %d\n", '%', PRINT_IDENTIFIER (owner_name),
(obj_out, NULL, 0, "%cid %s%s%s%s %d\n", '%', owner_str,
PRINT_IDENTIFIER (class_name), i) != NO_ERROR)
{
status = 1;
Expand Down Expand Up @@ -880,7 +891,7 @@ extract_objects (const char *exec_name, const char *output_dirname, const char *
* Dump the object definitions
*/
total_approximate_class_objects = est_objects;
snprintf (unloadlog_filename, sizeof (unloadlog_filename) - 1, "%s_unloaddb.log", output_prefix);
snprintf (unloadlog_filename, sizeof (unloadlog_filename) - 1, "%s_unloaddb.log", ctxt.output_prefix);
unloadlog_file = fopen (unloadlog_filename, "w+");
if (unloadlog_file != NULL)
{
Expand Down Expand Up @@ -910,7 +921,7 @@ extract_objects (const char *exec_name, const char *output_dirname, const char *
goto end;
}

snprintf (outfile, PATH_MAX - 1, "%s/%s_%s%s", output_dirname, output_prefix,
snprintf (outfile, PATH_MAX - 1, "%s/%s_%s%s", output_dirname, ctxt.output_prefix,
sm_ch_name ((MOBJ) class_ptr), OBJECT_SUFFIX);

obj_out->fp = fopen_ex (outfile, "wb");
Expand All @@ -921,7 +932,7 @@ extract_objects (const char *exec_name, const char *output_dirname, const char *
}
}

ret_val = process_class (i);
ret_val = process_class (ctxt, i);

if (datafile_per_class && IS_CLASS_REQUESTED (i))
{
Expand Down Expand Up @@ -1040,7 +1051,7 @@ gauge_alarm_handler (int sig)
* cl_no(in): class object index for class_table
*/
static int
process_class (int cl_no)
process_class (extract_context & ctxt, int cl_no)
{
int error = NO_ERROR;
DB_OBJECT *class_ = class_table->mops[cl_no];
Expand Down Expand Up @@ -1069,6 +1080,8 @@ process_class (int cl_no)
time_t start = 0;
#endif
int total;
char output_owner[DB_MAX_USER_LENGTH + 4] = { '\0' };

LC_FETCH_VERSION_TYPE fetch_type = latest_image_flag ? LC_FETCH_CURRENT_VERSION : LC_FETCH_MVCC_VERSION;

/*
Expand Down Expand Up @@ -1113,10 +1126,13 @@ process_class (int cl_no)
if (v == 0)
{
SPLIT_USER_SPECIFIED_NAME (sm_ch_name ((MOBJ) class_ptr), owner_name, class_name);

PRINT_OWNER_NAME (owner_name, (ctxt.is_dba_user || ctxt.is_dba_group_member), output_owner,
sizeof (output_owner));

CHECK_PRINT_ERROR (text_print
(obj_out, NULL, 0, "%cclass %s%s%s.%s%s%s shared (%s%s%s", '%',
PRINT_IDENTIFIER (owner_name),
PRINT_IDENTIFIER (class_name), PRINT_IDENTIFIER (attribute->header.name)));
(obj_out, NULL, 0, "%cclass %s%s%s%s shared (%s%s%s", '%',
output_owner, PRINT_IDENTIFIER (class_name), PRINT_IDENTIFIER (attribute->header.name)));
}
else
{
Expand Down Expand Up @@ -1165,10 +1181,13 @@ process_class (int cl_no)
if (v == 0)
{
SPLIT_USER_SPECIFIED_NAME (sm_ch_name ((MOBJ) class_ptr), owner_name, class_name);

PRINT_OWNER_NAME (owner_name, (ctxt.is_dba_user || ctxt.is_dba_group_member), output_owner,
sizeof (output_owner));

CHECK_PRINT_ERROR (text_print
(obj_out, NULL, 0, "%cclass %s%s%s.%s%s%s class (%s%s%s", '%',
PRINT_IDENTIFIER (owner_name),
PRINT_IDENTIFIER (class_name), PRINT_IDENTIFIER (attribute->header.name)));
(obj_out, NULL, 0, "%cclass %s%s%s%s class (%s%s%s", '%',
output_owner, PRINT_IDENTIFIER (class_name), PRINT_IDENTIFIER (attribute->header.name)));
}
else
{
Expand Down Expand Up @@ -1205,9 +1224,11 @@ process_class (int cl_no)
}

SPLIT_USER_SPECIFIED_NAME (sm_ch_name ((MOBJ) class_ptr), owner_name, class_name);
CHECK_PRINT_ERROR (text_print (obj_out, NULL, 0, (v) ? "\n%cclass %s%s%s.%s%s%s (" /* new line */
: "%cclass %s%s%s.%s%s%s (", '%', PRINT_IDENTIFIER (owner_name),
PRINT_IDENTIFIER (class_name)));

PRINT_OWNER_NAME (owner_name, (ctxt.is_dba_user || ctxt.is_dba_group_member), output_owner, sizeof (output_owner));

CHECK_PRINT_ERROR (text_print (obj_out, NULL, 0, (v) ? "\n%cclass %s%s%s%s (" /* new line */
: "%cclass %s%s%s%s (", '%', output_owner, PRINT_IDENTIFIER (class_name)));

v = 0;
attribute = class_ptr->ordered_attributes;
Expand Down
Loading