<< " -a BASE64, --add-key BASE64 will add an encoded key to the keyring\n"
<< " --cap SUBSYSTEM CAPABILITY will set the capability for given subsystem\n"
<< " --caps CAPSFILE will set all of capabilities associated with a\n"
- << " given key, for all subsystems"
+ << " given key, for all subsystems\n"
+ << " --mode MODE will set the desired file mode to the keyring\n"
+ << " e.g: '0644', defaults to '0600'"
<< std::endl;
exit(1);
}
bool print_key = false;
bool create_keyring = false;
bool set_auid = false;
+ int mode = 0600; // keyring file mode
std::vector<const char*>::iterator i;
/* Handle options unique to ceph-authtool
exit(1);
}
set_auid = true;
+ } else if (ceph_argparse_witharg(args, i, &val, "--mode", (char*)NULL)) {
+ std::string err;
+ mode = strict_strtoll(val.c_str(), 8, &err);
+ if (!err.empty()) {
+ cerr << "Option --mode requires an argument" << std::endl;
+ exit(1);
+ }
} else if (fn.empty()) {
fn = *i++;
} else {
if (modified) {
bufferlist bl;
keyring.encode_plaintext(bl);
- r = bl.write_file(fn.c_str(), 0600);
+ r = bl.write_file(fn.c_str(), mode);
if (r < 0) {
cerr << "could not write " << fn << std::endl;
exit(1);