OpenVPN 3 Core Library
Loading...
Searching...
No Matches
getpw.hpp
Go to the documentation of this file.
1// OpenVPN -- An application to securely tunnel IP networks
2// over a single port, with support for SSL/TLS-based
3// session authentication and key exchange,
4// packet encryption, packet authentication, and
5// packet compression.
6//
7// Copyright (C) 2012- OpenVPN Inc.
8//
9// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10//
11
12#ifndef OPENVPN_COMMON_GETPW_H
13#define OPENVPN_COMMON_GETPW_H
14
16
17#if !defined(OPENVPN_PLATFORM_WIN)
18#include <pwd.h>
19#include <unistd.h>
20#else
22#endif
23
24#include <string>
25
27
28namespace openvpn {
29inline std::string get_password(const char *prompt)
30{
31#if !defined(OPENVPN_PLATFORM_WIN)
32 char *ret = getpass(prompt);
33 return ret;
34#else
35 Win::Console::Input i{true};
36 return i.get_password(prompt);
37#endif
38}
39} // namespace openvpn
40
41#endif
std::string get_password(const std::string &prompt)
Definition console.hpp:76
Support deferred server-side state creation when client connects.
Definition ovpncli.cpp:95
std::string get_password(const char *prompt)
Definition getpw.hpp:29
std::string ret