client: disable dynamic completions when in suid/sgid mode
Some checks failed
Build and test / check (push) Failing after 1m47s
Build and test / build (push) Successful in 3m48s
Build and test / test (push) Successful in 3m7s
Build and test / check-license (push) Successful in 5m39s
Build and test / docs (push) Successful in 8m9s

This commit is contained in:
2025-12-04 12:06:49 +09:00
parent b0ae6e563d
commit f5d3c46e60
11 changed files with 28 additions and 16 deletions

View File

@@ -19,7 +19,8 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct DropDbArgs { pub struct DropDbArgs {
/// The MySQL database(s) to drop /// The MySQL database(s) to drop
#[arg(num_args = 1.., add = ArgValueCompleter::new(mysql_database_completer))] #[arg(num_args = 1..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_database_completer)))]
name: Vec<MySQLDatabase>, name: Vec<MySQLDatabase>,
/// Print the information as JSON /// Print the information as JSON

View File

@@ -19,7 +19,8 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct DropUserArgs { pub struct DropUserArgs {
/// The MySQL user(s) to drop /// The MySQL user(s) to drop
#[arg(num_args = 1.., add = ArgValueCompleter::new(mysql_user_completer))] #[arg(num_args = 1..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
username: Vec<MySQLUser>, username: Vec<MySQLUser>,
/// Print the information as JSON /// Print the information as JSON

View File

@@ -29,7 +29,7 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct EditPrivsArgs { pub struct EditPrivsArgs {
/// The MySQL database to edit privileges for /// The MySQL database to edit privileges for
#[arg(add = ArgValueCompleter::new(mysql_database_completer))] #[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_database_completer)))]
pub name: Option<MySQLDatabase>, pub name: Option<MySQLDatabase>,
#[arg( #[arg(

View File

@@ -17,8 +17,9 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct LockUserArgs { pub struct LockUserArgs {
/// The MySQL user(s) to lock /// The MySQL user(s) to loc
#[arg(num_args = 1.., add = ArgValueCompleter::new(mysql_user_completer))] #[arg(num_args = 1..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
username: Vec<MySQLUser>, username: Vec<MySQLUser>,
/// Print the information as JSON /// Print the information as JSON

View File

@@ -22,7 +22,7 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct PasswdUserArgs { pub struct PasswdUserArgs {
/// The MySQL user whose password is to be changed /// The MySQL user whose password is to be changed
#[arg(add = ArgValueCompleter::new(mysql_user_completer))] #[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
username: MySQLUser, username: MySQLUser,
/// Read the new password from a file instead of prompting for it /// Read the new password from a file instead of prompting for it

View File

@@ -18,7 +18,8 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct ShowDbArgs { pub struct ShowDbArgs {
/// The MySQL database(s) to show /// The MySQL database(s) to show
#[arg(num_args = 0.., add = ArgValueCompleter::new(mysql_database_completer))] #[arg(num_args = 0..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_database_completer)))]
name: Vec<MySQLDatabase>, name: Vec<MySQLDatabase>,
/// Print the information as JSON /// Print the information as JSON

View File

@@ -19,7 +19,8 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct ShowPrivsArgs { pub struct ShowPrivsArgs {
/// The MySQL database(s) to show privileges for /// The MySQL database(s) to show privileges for
#[arg(num_args = 0.., add = ArgValueCompleter::new(mysql_database_completer))] #[arg(num_args = 0..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_database_completer)))]
name: Vec<MySQLDatabase>, name: Vec<MySQLDatabase>,
/// Print the information as JSON /// Print the information as JSON

View File

@@ -18,7 +18,8 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct ShowUserArgs { pub struct ShowUserArgs {
/// The MySQL user(s) to show /// The MySQL user(s) to show
#[arg(num_args = 0.., add = ArgValueCompleter::new(mysql_user_completer))] #[arg(num_args = 0..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
username: Vec<MySQLUser>, username: Vec<MySQLUser>,
/// Print the information as JSON /// Print the information as JSON

View File

@@ -18,7 +18,8 @@ use crate::{
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct UnlockUserArgs { pub struct UnlockUserArgs {
/// The MySQL user(s) to unlock /// The MySQL user(s) to unlock
#[arg(num_args = 1.., add = ArgValueCompleter::new(mysql_user_completer))] #[arg(num_args = 1..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
username: Vec<MySQLUser>, username: Vec<MySQLUser>,
/// Print the information as JSON /// Print the information as JSON

View File

@@ -130,21 +130,23 @@ pub struct CreateArgs {
#[derive(Parser)] #[derive(Parser)]
pub struct DatabaseDropArgs { pub struct DatabaseDropArgs {
/// The name of the DATABASE(s) to drop. /// The name of the DATABASE(s) to drop.
#[arg(num_args = 1.., add = ArgValueCompleter::new(mysql_database_completer))] #[arg(num_args = 1..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_database_completer)))]
name: Vec<MySQLDatabase>, name: Vec<MySQLDatabase>,
} }
#[derive(Parser)] #[derive(Parser)]
pub struct DatabaseShowArgs { pub struct DatabaseShowArgs {
/// The name of the DATABASE(s) to show. /// The name of the DATABASE(s) to show.
#[arg(num_args = 0.., add = ArgValueCompleter::new(mysql_database_completer))] #[arg(num_args = 0..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_database_completer)))]
name: Vec<MySQLDatabase>, name: Vec<MySQLDatabase>,
} }
#[derive(Parser)] #[derive(Parser)]
pub struct EditPermArgs { pub struct EditPermArgs {
/// The name of the DATABASE to edit permissions for. /// The name of the DATABASE to edit permissions for.
#[arg(add = ArgValueCompleter::new(mysql_database_completer))] #[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_database_completer)))]
pub database: MySQLDatabase, pub database: MySQLDatabase,
} }

View File

@@ -93,21 +93,24 @@ pub struct CreateArgs {
#[derive(Parser)] #[derive(Parser)]
pub struct DeleteArgs { pub struct DeleteArgs {
/// The name of the USER(s) to delete. /// The name of the USER(s) to delete.
#[arg(num_args = 1.., add = ArgValueCompleter::new(mysql_user_completer))] #[arg(num_args = 1..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
name: Vec<MySQLUser>, name: Vec<MySQLUser>,
} }
#[derive(Parser)] #[derive(Parser)]
pub struct PasswdArgs { pub struct PasswdArgs {
/// The name of the USER(s) to change the password for. /// The name of the USER(s) to change the password for.
#[arg(num_args = 1.., add = ArgValueCompleter::new(mysql_user_completer))] #[arg(num_args = 1..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
name: Vec<MySQLUser>, name: Vec<MySQLUser>,
} }
#[derive(Parser)] #[derive(Parser)]
pub struct ShowArgs { pub struct ShowArgs {
/// The name of the USER(s) to show. /// The name of the USER(s) to show.
#[arg(num_args = 0.., add = ArgValueCompleter::new(mysql_user_completer))] #[arg(num_args = 0..)]
#[cfg_attr(not(feature = "suid-sgid-mode"), arg(add = ArgValueCompleter::new(mysql_user_completer)))]
name: Vec<MySQLUser>, name: Vec<MySQLUser>,
} }