📄 cmount.c
字号:
/* $Id: cmount.C,v 1.3 2001/04/22 07:24:39 dm Exp $ *//* * * Copyright (C) 2001 David Mazieres (dm@uun.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */#include "sfsmisc.h"#include "cryptfsadm.h"#include "arpc.h"#include "crypt.h"intmain (int argc, char **argv){ setprogname (argv[0]); sfsconst_init (); if (argc != 2 && argc != 3) fatal << "usage: " << progname << "/ciphertext_dir [plaintext_name]\n"; int fd = suidgetfd_required ("cryptfs"); ref<aclnt> c = aclnt::alloc (axprt_stream::alloc (fd), cfsadm_prog_1); cfsadm_mount_arg arg; arg.path = argv[1]; if (arg.path[0] != '/') { char buf[PATH_MAX]; if (!getcwd (buf, sizeof (buf))) fatal ("cannot determine current working directory"); buf[sizeof (buf) - 1] = '\0'; arg.path = strbuf ("%s/", buf) << arg.path; } if (argc == 3) arg.name = argv[2]; else if (char *p = strrchr (arg.path, '/')) arg.name = p + 1; else assert (!"getcwd did not return slash"); arg.pwd = getpass ("Passphrase: "); u_int32_t res = EIO; c->scall (CFSADMPROC_MOUNT, &arg, &res); if (res) fatal << "cryptfs: " << strerror (res) << "\n"; return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -